2022Java认证考试试题2022年Java认证考试试题运用Java语言的先进的面对对象特点,包括方法重载,方法覆盖,抽象类,接口,final,static和访问限制;实现文件的`输入输出(I/O)。下面是我整理的关于Java认证考试试题,希望大家仔细阅读!question1)whichofthefollowinglineswillcompilewithout第1页共17页warningorerror.1)floatf=1.3;2)charc='a';3)byteb=257;4)booleanb=null;5)inti=10;answertoquestion1question2)whatwillhappenifyoutrytocompileandrunthe第2页共17页followingcodepublicclassmyclass{publicstaticvoidmain(stringarguments[]){amethod(arguments);}publicvoidamethod(string[]arguments){system.out.println(arguments);system.out.println(arguments[1]);}第3页共17页}1)errorcan´tmakestaticreferencetovoidamethod.2)errormethodmainnotcorrect3)errorarraymustincludeparameter4)amethodmustbedeclaredwithstringanswertoquestion2question3)whichofthefollowingwillcompilewithouterror第4页共17页1)importjava.awt.*;packagemypackage;classmyclass{}2)packagemypackage;importjava.awt.*;classmyclass{}3)第5页共17页/*thisisacomment*/packagemypackage;importjava.awt.*;classmyclass{}answertoquestion3question4)abytecanbeofwhatsize1)-128to1272)(-2power8)-1to2power8第6页共17页3)-255to2564)dependsontheparticularimplementationofthejavavirtualmachineanswertoquestion4question5)whatwillbeprintedoutifthiscodeisrunwiththefollowingcommandline?javamyproggoodmorningpublicclassmyprog{第7页共17页publicstaticvoidmain(stringargv[]){system.out.println(argv[2])}}1)myprog2)good3)morning4)exceptionraised:第8页共17页'java.lang.arrayindexoutofboundsexception:2'answertoquestion5question6)whichofthefollowingarekeywordsorreservedwordsinjava?1)if2)then3)goto4)while第9页共17页whichofthefollowingstatementsaretrue?1)methodscannotbeoverridentobemoreprivate2)staticmethodscannotbeoverloaded3)privatemethodscannotbeoverloaded4)anoverloadedmethodcannotthrowexceptionsnotcheckedinthebaseclassanswertoquestion16question17)whatwillhappenifyouattempttocompileandrunthe第10页共17页followingcode?classbase{}classsubextendsbase{}classsub2extendsbase{}publicclasscex{publicstaticvoidmain(stringargv[]){baseb=newbase();subs=(sub)b;}第11页共17页}1)compileandrunwithouterror2)compiletimeexception3)runtimeexceptionanswertoquestion17question18)whichofthefollowingstatementsaretrue?1)system.out.println(-1>>>2);willoutputaresultlargerthan10第12页共17页2)system.out.println(-1>>>2);willoutputapositivenumber3)system.out.println(2>>1);willoutputthenumber14)system.out.println(1<<<2);willoutputthenumber4answertoquestion18question19)whatwillhappendwhenyouattempttocompileandrun第13页共17页thefollowingcode?publicclasstuxextendsthread{staticstringsname='vandeleur';publicstaticvoidmain(stringargv[]){tuxt=newtux();t.piggy(sname);system.out.println(sname);}publicvoidpiggy(stringsname){第14页共17页sname=sname+'wiggy';start();}publicvoidrun(){for(inti=0;i<4;i++){sname=sname+''+i;}}}第15页共17页1)compiletimeerror2)compilationandoutputof'vandeleurwiggy'3)compilationandoutputof'vandeleurwiggy0123'4)compilationandprobablyoutputof'vandeleur'butpossibleoutputof'vandeleur0123'answertoquestion19question20)第16页共17页whatwillbedisplayedwhenyouattempttocompileandrunthefollowingcode//codestart本文来源:网络收集与整理,如有侵权,请联系作者删除,谢谢!第17页共17页