niusouti.com

单选题class Test2{   public static void main(String [] args){   boolean x=true;   boolean y=false;   short z=42;   if((x==true)&&y=true))z++;   if((y==true||++z=44))z++;   System.out.println(“z=”+z);  }  }   结果是什么?()Az=42Bz=43C z=44Dz=45E 编译失败F 运行的时候有异常抛出

题目
单选题
class Test2{   public static void main(String [] args){   boolean x=true;   boolean y=false;   short z=42;   if((x==true)&&y=true))z++;   if((y==true||++z=44))z++;   System.out.println(“z=”+z);  }  }   结果是什么?()
A

 z=42

B

 z=43

C

z=44

D

 z=45

E

编译失败

F

运行的时候有异常抛出


相似考题
更多“单选题class Test2{   public static void main(String [] args){   boolean x=true;   boolean y=false;   short z=42;   if((x==true)y=true))z++;   if((y==true||++z=44))z++;   System.out.println(“z=”+z);  }  }   结果是什么?()A  z=42B  z=43C z=44D  z=45E 编译失败F 运行的时候有异常抛”相关问题
  • 第1题:

    classTest2{publicstaticvoidmain(String[]args){booleanx=true;booleany=false;shortz=42;if((x==true)&&y=true))z++;if((y==true||++z=44))z++;System.out.println(z=”+z);}}结果是什么?()

    A.z=42

    B.z=43

    C.z=44

    D.z=45

    E.编译失败

    F.运行的时候有异常抛出


    参考答案:D

  • 第2题:

    classTest4{publicstaticvoidmain(String[]args){booleanx=true;booleany=false;shortz=42;if((z++==42)&&(y=true))z++;if((x=false)||(++z==45))z++;System.out.println("z="+z);}}结果为:()

    A.z=42

    B.z=44

    C.z=45

    D.z=46


    参考答案:D

  • 第3题:

    现有:classTest4{publicstaticvoidmain(String[]args){booleanX=true;booleany=false;shortZ=42;if((z++==42)&&(y=true))z++;if((x=false)||(++z==45))z++;System.out.println(¨z=”+z);}}结果为:()

    A.Z=42

    B.z=44

    C.Z=45

    D.z=46


    参考答案:D

  • 第4题:

    阅读下面程序 public class Test3 { public static void main(String[] args) { int x=3,y=4,z=5; String s="xyz": System.out.println(s+x+y+z); } } 程序运行的结果是

    A.xyz12

    B.xyz345

    C.xyzxyz

    D.12xyz


    正确答案:B
    解析:Java中对+运算符的功能进行了扩展,使其能够进行字符串连接。如"xyz"+"rst"结果为"xyzrst","xyz"+3结果为"xyz3"。如果运算符+的第一个操作数不是字符串,则运算结果由后续的操作数决定,如3+4+5+"xyz"的结果是"12xyz",而不是"345xyz"。

  • 第5题:

    以下程序的输出结果为:public class test {public static void main(String args[]) {int x=1,y=1,z=1;if (x--==1&&y++==1||z++== 1、System.out.println("x="+x+",y="+y+",z="+z);}}

    A. x=0,y=2,z=1

    B. x=1,y=2,z=1

    C. x=0,y=1,z=1

    D. x=0,y=2,z=2


    正确答案:A

  • 第6题:

    现有:  class  Test4  {  public static void main (String  []  args)  {    boolean X=true;   boolean y=false;    short Z=42;    if((z++==42)  &&  (y=true))z++;    if((x=false)  ||    (++z==45))  z++;    System. out.println(¨z=”+z);     }    }  结果为:() 

    • A、  Z=42
    • B、  z=44
    • C、  Z= 45
    • D、  z= 46

    正确答案:D

  • 第7题:

    现有:  class Foo  {  public static void main (String  []  args)  {      int x=O;      int y=4;  for (int  z=0;  z<3;  Z++;  X++)  {     if(x>1&++y<10)    y++;    }  System. out .println (y);  }   }  结果是什么?()     

    • A、7
    • B、8
    • C、10
    • D、12

    正确答案:B

  • 第8题:

    class Test2{   public static void main(String [] args){   boolean x=true;   boolean y=false;   short z=42;   if((x==true)&&y=true))z++;   if((y==true||++z=44))z++;   System.out.println(“z=”+z);  }  }   结果是什么?()  

    • A、 z=42
    • B、 z=43
    • C、z=44
    • D、 z=45
    • E、编译失败
    • F、运行的时候有异常抛出

    正确答案:D

  • 第9题:

    class Test4 {   public static void main(String [] args) {   boolean x = true;   boolean y = false;   short z = 42;   if((z++ = = 42) && (y = true)) z++;   if((x = false) || (++z = = 45)) z++;   System.out.println("z = " + z);   }   }   结果为:()  

    • A、z = 42
    • B、z = 44
    • C、z = 45
    • D、z = 46

    正确答案:D

  • 第10题:

    单选题
    现有:  class Test2  f  public static void main (String  []  args)  {      boolean X= true;      boolean y=false;      short Z=20;      if((x==true)  &&  (y=true))  z++;     if((y==true) ||  (++z==22))  z++;      System. out .println( "z="+z);      }      结果是什么?()
    A

    Z=21

    B

    Z=22

    C

    Z=23

    D

    Z= 24


    正确答案: C
    解析: 暂无解析

  • 第11题:

    单选题
    class Test2{   public static void main(String [] args){   boolean x=true;   boolean y=false;   short z=42;   if((x==true)&&y=true))z++;   if((y==true||++z=44))z++;   System.out.println(“z=”+z);  }  }   结果是什么?()
    A

     z=42

    B

     z=43

    C

    z=44

    D

     z=45

    E

    编译失败

    F

    运行的时候有异常抛出


    正确答案: A
    解析: 暂无解析

  • 第12题:

    单选题
    class Foo {  public static void main(String [] args) {  int x = 0;  int y = 4;  for(int z=0; z 〈 3; z++, x++) {  if(x 〉 1 & ++y 〈 10) y++;  }  System.out.println(y);  }  }  结果是什么?()
    A

    6

    B

    7

    C

    8

    D

    10


    正确答案: B
    解析: 暂无解析

  • 第13题:

    classFoo{publicstaticvoidmain(String[]args){intx=0;inty=4;for(intz=0;z〈3;z++,x++){if(x〉1&++y〈10)y++;}System.out.println(y);}}结果是什么?()

    A.6

    B.7

    C.8

    D.10


    参考答案:C

  • 第14题:

    现有:classTest2fpublicstaticvoidmain(String[]args){booleanX=true;booleany=false;shortZ=20;if((x==true)&&(y=true))z++;if((y==true)||(++z==22))z++;System.out.println("z="+z);}结果是什么?()

    A.Z=21

    B.Z=22

    C.Z=23

    D.Z=24


    参考答案:B

  • 第15题:

    执行下列代码段之后,变量z的值为______。 Public class Test8 { public static void main(String[] args) { int x=2; int y=3; int z=4; z-....= y-x--; System.out.println(z); }

    A.1

    B.2

    C.3

    D.4


    正确答案:D
    解析:表达式中的运算次序应该是先对y做减量运算,得到y=2,然后再取x的值x=2,做减法运算得到0,最后用z减去0,得到答案为4。

  • 第16题:

    写出执行完下列代码段之后指定变量的值:

    bool x=true ,y=false,z=false;

    x=x&&y||z;

    y=x||y&&z;

    z=!(x!=y)||(y==z);

    则x=false,y=【 】,z=【 】。


    正确答案:false true
    false true 解析:执行语句“x&&y||z;”后,x的值变为false。执行“x||y&&z”后,y的值变为false,执行“!(x!=y)||y==z);”后,z的值变为true。

  • 第17题:

    现有:  class Test2  f  public static void main (String  []  args)  {      boolean X= true;      boolean y=false;      short Z=20;      if((x==true)  &&  (y=true))  z++;     if((y==true) ||  (++z==22))  z++;      System. out .println( "z="+z);      }      结果是什么?()     

    • A、Z=21
    • B、Z=22
    • C、Z=23
    • D、Z= 24

    正确答案:B

  • 第18题:

    class Foo {  public static void main(String [] args) {  int x = 0;  int y = 4;  for(int z=0; z 〈 3; z++, x++) {  if(x 〉 1 & ++y 〈 10) y++;  }  System.out.println(y);  }  }  结果是什么?()  

    • A、6
    • B、7
    • C、8
    • D、10

    正确答案:C

  • 第19题:

    public class Yikes {  public static void go(Long n) {System.out.println(”Long “);}  public static void go(Short n) {System.out.println(”Short “);}  public static void go(int n) {System.out.println(”int “);}  public static void main(String [] args) {  short y= 6;  long z= 7;  go(y);  go(z);  }  }  What is the result?() 

    • A、 int Long
    • B、 Short Long
    • C、 Compilation fails.
    • D、 An exception is thrown at runtime.

    正确答案:A

  • 第20题:

    public class Wow {  public static void go(short n) {System.out.println(”short”); }  public static void go(Short n) {System.out.println(”SHORT”);}  public static void go(Long n) {System.out.println(” LONG”); }  public static void main(String [] args) {  Short y= 6;  int z=7;  go(y);  go(z);  }  }  What is the result?() 

    • A、 short LONG
    • B、 SHORT LONG
    • C、 Compilation fails.
    • D、 An exception is thrown at runtime.

    正确答案:C

  • 第21题:

    单选题
    现有:  class  Test4  {  public static void main (String  []  args)  {    boolean X=true;   boolean y=false;    short Z=42;    if((z++==42)  &&  (y=true))z++;    if((x=false)  ||    (++z==45))  z++;    System. out.println(¨z=”+z);     }    }  结果为:()
    A

      Z=42

    B

      z=44

    C

      Z= 45

    D

      z= 46


    正确答案: A
    解析: 暂无解析

  • 第22题:

    单选题
    执行完下列代码段之后:bool x=true, y=false, z=false; x=x&&y||z; y=x||y&&z; z=!(x!=y)||(y-z); 则x=false,y=false,z=(  )。
    A

    true

    B

    false

    C

    不确定

    D

    异常


    正确答案: D
    解析:
    其中“x=x&&y||z;”语句计算后 x=false,“y=x||y&&z;”语句计算后y=false。那么“z=!(x!=y)||(y—z);”语句计算后“z=!(ture)||true”,所以答案为:true。

  • 第23题:

    单选题
    class Test4 {   public static void main(String [] args) {   boolean x = true;   boolean y = false;   short z = 42;   if((z++ = = 42) && (y = true)) z++;   if((x = false) || (++z = = 45)) z++;   System.out.println("z = " + z);   }   }   结果为:()
    A

    z = 42

    B

    z = 44

    C

    z = 45

    D

    z = 46


    正确答案: B
    解析: 暂无解析

  • 第24题:

    单选题
    public class Wow {  public static void go(short n) {System.out.println(”short”); }  public static void go(Short n) {System.out.println(”SHORT”);}  public static void go(Long n) {System.out.println(” LONG”); }  public static void main(String [] args) {  Short y= 6;  int z=7;  go(y);  go(z);  }  }  What is the result?()
    A

     short LONG

    B

     SHORT LONG

    C

     Compilation fails.

    D

     An exception is thrown at runtime.


    正确答案: A
    解析: 暂无解析