itgle.com

publicclassIfTest(publicstaticvoidmain(stringargs){intx=3;inty=1;if(x=y)system.out.printIn(Notequal”);elsesystem.out.printIn(Equal”);})Whatistheresult?()A.Theoutputis“Equal”B.Theoutputin“NotEqual”C.Anerroratline5causescompilationtofall.D.Theprogramexecute

题目
publicclassIfTest(publicstaticvoidmain(stringargs){intx=3;inty=1;if(x=y)system.out.printIn(Notequal”);elsesystem.out.printIn(Equal”);})Whatistheresult?()

A.Theoutputis“Equal”

B.Theoutputin“NotEqual”

C.Anerroratline5causescompilationtofall.

D.Theprogramexecutesbutdoesnotprintamessage.


相似考题
参考答案和解析
参考答案:C
更多“publicclassIfTest(publicstaticvoidmain(stringargs){intx=3;inty=1;if(x=y)system.out.printIn(Notequal”);elsesystem.out.printIn(Equal”);})Whatistheresult?() ”相关问题
  • 第1题:

    publicclassX{publicstaticvoidmain(Stringargs){Strings1=newString(true”);Booleanb1=newBoolean(true);if(s2.equals(b1)){System.out.printIn(Equal”);}}}Whatistheresult?()

    A.Theprogramrunsandprintsnothing.

    B.Theprogramrunsandprints“Equal”

    C.Anerroratline5causescompilationtofail.

    D.Theprogramrunsbutabortswithanexception.


    参考答案:A

  • 第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".


    正确答案:B

  • 第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"); }


    2null

  • 第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”)


    参考答案:E

  • 第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.编译错误


    B