A.Theoutputis“Equal”
B.Theoutputin“NotEqual”
C.Anerroratline5causescompilationtofall.
D.Theprogramexecutesbutdoesnotprintamessage.
第1题:
A.Theprogramrunsandprintsnothing.
B.Theprogramrunsandprints“Equal”
C.Anerroratline5causescompilationtofail.
D.Theprogramrunsbutabortswithanexception.
第2题:
编译和运行以下代码结果为:
1. public class EqualsTest{
2. public static void main(String args[]){
3. byte A=(byte)4096;
4. if(A== 4096、System.out.println("Equal");
5. else System.out.println("Not Equal");
6. }
7. }
A.在第3行出现转换丢失精度的编译错误.
B.输出 "Not Equal".
C.输出 "Equal".
第3题:
2、下面程序的输出结果是什么?public static void main(String args[]){ int a=10; int b=20; if(a>b) System.out.println("Not Equal"); else System.out.println("Equal"); }
第4题:
publicclassXimplementsRunnable(privateintx;privateinty;publicstaticvoidmain(Stringargs)(Xthat=newX();(newThread(that)).start();(newThread(that)).start();)publicsynchronizedvoidrun()(for(;;)(x++;y++;System.out.printIn(x=+x+,y=+y);)))Whatistheresult?()
A.Anerroratline11causescompilationtofail.
B.Errorsatlines7and8causecompilationtofail.
C.Theprogramprintspairsofvaluesforxandythatmightnotalwaysbethesameonthesameline(forexample,“x=2,y=1”)
D.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”.Inaddition,eachvalueappearstwice(forexample,“x=1,y=1”followedby“x=1,y=1”)
E.Theprogramprintspairsofvaluesforxandythatarealwaysthesameonthesameline(forexample,“x=1,y=1”.Inaddition,eachvalueappearstwice(forexample,“x=1,y=1”followedby“x=2s,y=2”)
第5题:
以下程序的调试结果为? 1. public class EqualsTest{ 2. public static void main(String args[]){ 3. Long LA = new Long(7); 4. Long LB = new Long(7); 5. if(LA==LB) System.out.println("Equal"); 6. else System.out.println("Not Equal"); 7. } 8. }
A.程序在执行到第5行时出现异常
B.输出"Not Equal"
C.输出"Equal"
D.编译错误