欢迎来到天天文库
浏览记录
ID:17417348
大小:68.50 KB
页数:20页
时间:2018-08-31
《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);//r
2、eturn;}publicvoidmethod(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(
3、rt1.a+""+rt2.a);rt2=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[]
4、){Peoplepeople=newPeople();inta=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{
5、publicChild(){super(1);System.out.println("Child");}publicstaticvoidmain(Stringargs[]){Childchild=newChild();}}classParent{publicParent(inti){System.out.println("parent1");}publicParent(){System.out.println("parent2");}}publicclassParamTest{publicvoidchan
6、gePoint(Pointpoint){//Pointpoint=newPoint();point.x=3;point.y=4;}publicstaticvoidmain(Stringargs[]){ParamTestpt=newParamTest();Pointpoint=newPoint();pt.changePoint(point);System.out.println(point.x+""+point.y);}}classPoint{intx;inty;}publicclassParamTes
7、t2{publicstaticvoidmain(Stringargs[]){Cc=newC();inta=1;c.changeInt(a);System.out.println(a);}}classC{voidchangeInt(inta){a++;}}publicclassParamTest3{publicvoidchange(Personperson1,Personperson2){person1.name="lisi";person2.name="wangwu";}publicstaticvoidm
8、ain(Stringargs[]){Personperson1=newPerson();person1.name="zhangsan";Personperson2=newPerson();//Personperson2=person1;ParamTest3test=newParamTest3();test.change(person1,person2);System.out.println(person1.name+""+
此文档下载收益归作者所有