欢迎来到天天文库
浏览记录
ID:45756541
大小:88.66 KB
页数:104页
时间:2019-11-17
《java基础练习程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、1.ArgsWords.javaimportjava.util.*;〃自动装包拆包publicclassArgsWords{publicstaticvoidmain(String[]args){Mapml=newHashMapO;for(inti=O;i2、n(ml.size()+"distinctwordsdectected:1');System.out.println(ml);}}2.BasicGeneric.javaimportjava.util.*;〃泛型publicclassBasicGeneric{publicstaticvoidmain(String[]args){ListLI=newArrayList();Ll.add("aaa");Ll.addC'bbb");Ll-addC^cc");for(inti=O;i3、ze();i++){Strings=Ll.get(i);System.out.println(i);}Collect!onvString>c=newHashSet();c.add("aaa");c.add("bbb");c.add("ddd");for(lteratorit=c.iterator();it.hasNext();){Strings=it.next();System.out.println(s);}}}classMyNameimplementsComparable4、me>{intage;publicintcompareTo(MyNamemn){讦(this.age>mn.age)return1;elseif(this.age5、;}System.out.println("");Collectionc=newArrayList();c.add("aaa");c.addf'eee");c・add(”ff”);for(Objecto:c){System.out.print(o+"");}}}2.TestArgsWords.javaimportjava.util.*;publicclassTestArgsWords{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(S6、tring[]args)Mapm=newHashMapO;for(inti=O;i7、java.util.*;publicclassTestArgsWords2{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(String[]args){Mapm=newHashMap();for(inti=O;i8、;}System.out.println(m.size()+“distinctwordsdected:11);System.out.println(m);}6・TestAutoBoxing.javaimportjava.util.*;动装包、拆包publicclassTestAutoBoxingpublicstaticvoidmain(Stri
2、n(ml.size()+"distinctwordsdectected:1');System.out.println(ml);}}2.BasicGeneric.javaimportjava.util.*;〃泛型publicclassBasicGeneric{publicstaticvoidmain(String[]args){ListLI=newArrayList();Ll.add("aaa");Ll.addC'bbb");Ll-addC^cc");for(inti=O;i3、ze();i++){Strings=Ll.get(i);System.out.println(i);}Collect!onvString>c=newHashSet();c.add("aaa");c.add("bbb");c.add("ddd");for(lteratorit=c.iterator();it.hasNext();){Strings=it.next();System.out.println(s);}}}classMyNameimplementsComparable4、me>{intage;publicintcompareTo(MyNamemn){讦(this.age>mn.age)return1;elseif(this.age5、;}System.out.println("");Collectionc=newArrayList();c.add("aaa");c.addf'eee");c・add(”ff”);for(Objecto:c){System.out.print(o+"");}}}2.TestArgsWords.javaimportjava.util.*;publicclassTestArgsWords{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(S6、tring[]args)Mapm=newHashMapO;for(inti=O;i7、java.util.*;publicclassTestArgsWords2{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(String[]args){Mapm=newHashMap();for(inti=O;i8、;}System.out.println(m.size()+“distinctwordsdected:11);System.out.println(m);}6・TestAutoBoxing.javaimportjava.util.*;动装包、拆包publicclassTestAutoBoxingpublicstaticvoidmain(Stri
3、ze();i++){Strings=Ll.get(i);System.out.println(i);}Collect!onvString>c=newHashSet();c.add("aaa");c.add("bbb");c.add("ddd");for(lteratorit=c.iterator();it.hasNext();){Strings=it.next();System.out.println(s);}}}classMyNameimplementsComparable4、me>{intage;publicintcompareTo(MyNamemn){讦(this.age>mn.age)return1;elseif(this.age5、;}System.out.println("");Collectionc=newArrayList();c.add("aaa");c.addf'eee");c・add(”ff”);for(Objecto:c){System.out.print(o+"");}}}2.TestArgsWords.javaimportjava.util.*;publicclassTestArgsWords{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(S6、tring[]args)Mapm=newHashMapO;for(inti=O;i7、java.util.*;publicclassTestArgsWords2{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(String[]args){Mapm=newHashMap();for(inti=O;i8、;}System.out.println(m.size()+“distinctwordsdected:11);System.out.println(m);}6・TestAutoBoxing.javaimportjava.util.*;动装包、拆包publicclassTestAutoBoxingpublicstaticvoidmain(Stri
4、me>{intage;publicintcompareTo(MyNamemn){讦(this.age>mn.age)return1;elseif(this.age5、;}System.out.println("");Collectionc=newArrayList();c.add("aaa");c.addf'eee");c・add(”ff”);for(Objecto:c){System.out.print(o+"");}}}2.TestArgsWords.javaimportjava.util.*;publicclassTestArgsWords{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(S6、tring[]args)Mapm=newHashMapO;for(inti=O;i7、java.util.*;publicclassTestArgsWords2{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(String[]args){Mapm=newHashMap();for(inti=O;i8、;}System.out.println(m.size()+“distinctwordsdected:11);System.out.println(m);}6・TestAutoBoxing.javaimportjava.util.*;动装包、拆包publicclassTestAutoBoxingpublicstaticvoidmain(Stri
5、;}System.out.println("");Collectionc=newArrayList();c.add("aaa");c.addf'eee");c・add(”ff”);for(Objecto:c){System.out.print(o+"");}}}2.TestArgsWords.javaimportjava.util.*;publicclassTestArgsWords{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(S
6、tring[]args)Mapm=newHashMapO;for(inti=O;i7、java.util.*;publicclassTestArgsWords2{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(String[]args){Mapm=newHashMap();for(inti=O;i8、;}System.out.println(m.size()+“distinctwordsdected:11);System.out.println(m);}6・TestAutoBoxing.javaimportjava.util.*;动装包、拆包publicclassTestAutoBoxingpublicstaticvoidmain(Stri
7、java.util.*;publicclassTestArgsWords2{privatestaticfinalIntegerONE=newInteger(l);publicstaticvoidmain(String[]args){Mapm=newHashMap();for(inti=O;i8、;}System.out.println(m.size()+“distinctwordsdected:11);System.out.println(m);}6・TestAutoBoxing.javaimportjava.util.*;动装包、拆包publicclassTestAutoBoxingpublicstaticvoidmain(Stri
8、;}System.out.println(m.size()+“distinctwordsdected:11);System.out.println(m);}6・TestAutoBoxing.javaimportjava.util.*;动装包、拆包publicclassTestAutoBoxingpublicstaticvoidmain(Stri
此文档下载收益归作者所有