摘要: class Tree{ Tree(){ System.out.print("默认构造器\n"); } Tree(int i){ System.out.print("重载构造器\n"); } void info(){ System.out.print("默认方法\n"); } void info(int k){ System.out.print("重载方法\n"); }}public class Overloading { public static void main(String[]... 阅读全文
posted @ 2013-03-08 10:45 玉伽 阅读(137) 评论(0) 推荐(0)
摘要: class rock{ rock(int i){ System.out.print("rock"+i+" "); } rock(int i,int m){ System.out.print("rock"+m+" "); } }public class constructor { public static void main(String[] args){ for(int i=0; i<10 ;i++){ new rock(i,2*i); } }}在创建对象new r... 阅读全文
posted @ 2013-03-08 10:41 玉伽 阅读(127) 评论(0) 推荐(0)