欢迎来到天天文库
浏览记录
ID:21733113
大小:40.50 KB
页数:23页
时间:2018-10-24
《java编程思想练习题答案》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、精品文档java编程思想练习题答案第二章练习1:publicclassPrimitiveTest{}练习2:publicclassHelloWorld{}练习3:publicclassATNTest{}练习4:publicclassDataOnlyTest{publicstaticvoidmain{classDataOnly{inti;doubled;booleanb;voidshow{System.out.println;System.out.println;}classATypeName{}inti;do
2、ubled;booleanb;voidshow{}System.out.println;System.out.println;System.out.println;publicstaticvoidmain{publicstaticvoidmain{}System.out.println;staticinti;staticcharc;}publicstaticvoidmain{System.out.println;System.out.println;ATypeNamea=newATypeName;a.i=;a
3、.d=.71828;a.b=false;a.show;}}}}System.out.println;DataOnlydata=newDataOnly;data.i=;data.d=.71828;data.b=false;2016全新精品资料-全新公文范文-全程指导写作–独家原创23/23精品文档data.show;练习5:publicclassDOTest{}练习6:publicclassStorageTest{}练习7:classStaticTest{}staticinti=7;publicstaticvo
4、idmain{}classDataOnly{}inti;doubled;booleanb;voidshow{}System.out.println;System.out.println;System.out.println;DataOnlydata=newDataOnly;data.i=34;data.d=.1234545;data.b=true;data.show;publicstaticvoidmain{}classStoreStuff{}StoreStuffx=newStoreStuff;System.
5、out.println);intstorage{}returns.length*;classIncrementable{}publicclassITest{}练习8:classStaticTest{}classIncrementable2016全新精品资料-全新公文范文-全程指导写作–独家原创23/23精品文档{}publicclassOneStaticTest{publicstaticvoidmain{System.out.println;StaticTestst1=newStaticTest;Static
6、Testst=newStaticTest;System.out.println;System.out.println;Incrementable.increment;System.out.printlncalled:“);System.out.println;System.out.println;Incrementable.increment;System.out.println;System.out.println;System.out.println;staticvoidincrement{StaticT
7、est.i++;}staticinti=7;publicstaticvoidmain{System.out.println;StaticTestst1=newStaticTest;StaticTestst=newStaticTest;System.out.println;System.out.println;Incrementablesf=newIncrementable;sf.increment;System.out.printlncalled:“);System.out.println;System.ou
8、t.println;Incrementable.increment;System.out.println;System.out.println;System.out.println;}staticvoidincrement{StaticTest.i++;}}}System.out.println;System.out.println;System.out.println;System.out.pri
此文档下载收益归作者所有