posts - 35,  comments - 7,  trackbacks - 0
package aa;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

//for test6
import static java.lang.Math.*;

public class Test {

    
public static void main(String[] args) {
        
// 1
        Double d = 123.45;
        d 
+= 20.601;
        System.out.println(d);
        
double dd = d + 45.123;
        System.out.println(dd);

        
// 2,3
        List<List<String>> list = new ArrayList<List<String>>();

        List
<String> line1 = new ArrayList<String>();
        line1.add(
"hello");
        line1.add(
",");
        line1.add(
"world");
        
// line1.add(new Integer(123));//complie error
        list.add(line1);

        List
<String> line2 = new ArrayList<String>();
        line2.add(
"hello2");
        line2.add(
",");
        line2.add(
"world2");
        list.add(line2);

        
for (List<String> g : list) {
            
for (String str : g) {
                System.out.print(str);
            }

            System.out.println();
        }


        
// 4
        Color bg = Color.Red;
        System.out.println(bg);

        
for (Color c : Color.values()) {
            System.out.println(c);
        }


        
// 5
        print("hello"",""World"new Date(), 123456);
        
        
//6
        double i=2*PI;
        print(i);

    }


    
public static void print(Object objects) {
        
for (Object obj : objects) {
            System.out.println(obj);
        }

    }


}


enum Color {
    Red, Green, Blue
}

posted on 2006-02-05 10:55 java小记 阅读(225) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

<2006年2月>
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011

常用链接

留言簿(1)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜