欢迎来到天天文库
浏览记录
ID:1712331
大小:68.50 KB
页数:20页
时间:2017-11-13
《java 程序设计 编程 实例 大全 深入 一》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、java程序设计编程实例大全深入一publicclassFloatTest{publicstaticvoidmain(Stringargs[]){floatf=1.2f;floats=1.3F;floatt=(float)1.4;System.out.println(f+""+s+""+t);}}publicclassReturnTest{publicstaticvoidmain(Stringargs[]){ReturnTestrt=newReturnTest();rt.method(2);//return;}pub
2、licvoidmethod(inta){if(a<3){System.out.println(++a);System.out.println(++a);}}}publicclassReferenceTest{inta=4;publicstaticvoidmain(Stringargs[]){ReferenceTestrt1=newReferenceTest();ReferenceTestrt2=newReferenceTest();rt1.a=5;System.out.println(rt1.a+""+rt2.a);rt
3、2=rt1;rt1.a=5;System.out.println(rt1.a+""+rt2.a);}}publicclassPeople{intage;publicvoidchange1(inti){i++;}publicvoidchange2(Peoplep){p=newPeople();p.age++;}publicvoidchange3(Peoplep,inti){p.age++;i++;}publicstaticvoidmain(Stringargs[]){Peoplepeople=newPeople();int
4、a=0;/*people.change1(people.age);System.out.println(people.age);*//*people.change2(people.age);System.out.println(people.age);*/people.change3(people,people.age);System.out.println(people.age);}}publicclassChildextendsParent{publicChild(){super(1);System.out.printl
5、n("Child");}publicstaticvoidmain(Stringargs[]){Childchild=newChild();}}classParent{publicParent(inti){System.out.println("parent1");}publicParent(){System.out.println("parent2");}}publicclassParamTest{publicvoidchangePoint(Pointpoint){//Pointpoint=newPoint();point.
6、x=3;point.y=4;}publicstaticvoidmain(Stringargs[]){ParamTestpt=newParamTest();Pointpoint=newPoint();pt.changePoint(point);System.out.println(point.x+""+point.y);}}classPoint{intx;inty;}publicclassParamTest2{publicstaticvoidmain(Stringargs[]){Cc=newC();inta=1;c.cha
7、ngeInt(a);System.out.println(a);}}classC{voidchangeInt(inta){a++;}}publicclassParamTest3{publicvoidchange(Personperson1,Personperson2){person1.name="lisi";person2.name="wangwu";}publicstaticvoidmain(Stringargs[]){Personperson1=newPerson();person1.name="zhangsan";Pe
8、rsonperson2=newPerson();//Personperson2=person1;ParamTest3test=newParamTest3();test.change(person1,person2);System.out.println(person1.name+""+
此文档下载收益归作者所有