摘要:
foreach格式for(类型 变量:遍历对象){访问变量;}如下程序:package com.foreach.test1;import java.util.ArrayList;import java.util.List;public class ForEachTest1 { public static void main(String args[]) { ForEachTest1 t1 = new ForEachTest1(); t1.test1(); t1.listTest(); } public void test1() { int array1[]={1,2,3,5,4}; for(i 阅读全文
posted @ 2011-08-16 21:57
snowdrop
阅读(136)
评论(0)
推荐(0)
摘要:
从视频中学得:集合排序需要注意两点:(1)传入对象要自己能排序(自己提供排序方法);(2)要使用排序类下面两个类:1、自己定义的类package com.collection.test1;public class UserModule1 implements Comparable{ // 定义一些属性 private String userId, name; private int age; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = user 阅读全文
posted @ 2011-08-16 12:00
snowdrop
阅读(394)
评论(0)
推荐(0)
浙公网安备 33010602011771号