单选题public class IfTest (   public static void main(stringargs) {   int x = 3;  int y = 1;   if (x = y)   system.out.printIn(“Not equal”);   else   system.out.printIn(“Equal”);   }   )   What is the result?()A The output is “Equal”B The output in “Not Equal”C An error at line 5 causes compilation to fall.D The program executes but does not print a message.

单选题
public class IfTest (   public static void main(stringargs) {   int x = 3;  int y = 1;   if (x = y)   system.out.printIn(“Not equal”);   else   system.out.printIn(“Equal”);   }   )   What is the result?()
A

 The output is “Equal”

B

 The output in “Not Equal”

C

 An error at line 5 causes compilation to fall.

D

 The program executes but does not print a message.


参考解析

解析: 暂无解析

相关考题:

下面程序的输出为( )。 public class Test { public static void main (String args[]) { int x,y; x=1; y=2; System.out.println("The output is"+x+y); } }A.The output is xyB.The output is 3C.The output is 12D.The output is x=1 y=2

下面程序段的输出结果是 public class Test{ public static void main(Stringargs[]){ int x,y; x=(int)Math.sqrt(5)/2+(int)Math.random()*5/2; y=(int)Math.sqrt(3)/2+(ht)Math.random()*3/2; if(x>y) System.out.println(”x>y”); else if(x=y) System.out.println(”x=y”); else System.out.Println(”x<y”); } }A.x>yB.x=yC.x<yD.编译错误

下面的例子中using System;class A{public static int X;static A(){X=B.Y+1;}}class B{public static int Y=A.X+1;static B(){}static void Main(){Console.WriteLine("X={0},Y={1}",A.X,B.Y);}}产生的输出结果是什么?

Public class test (  Public static void main (String args[])  (  System.out.printIn (6 ^ 3);  )  )   What is the output?()

public class WhileFoo {  public static void main (String []args)   {  int x= 1, y = 6;  while (y--)  {x--;}  system.out.printIn(“x=” + x “y =” + y);  }  }   What is the result?()  A、 The output is x = 6 y = 0B、 The output is x = 7 y = 0C、 The output is x = 6 y = -1D、 The output is x = 7 y = -1E、 Compilation will fail.

public class X implements Runnable(    private int x;   private int y;   public static void main(Stringargs)  X that = new X();   (new Thread(that)).start();  (new Thread(that)).start();  )  public void run() (  for (;;) (  x++;   y++;   System.out.printIn(“x=” + x + “, y = ” + y);   )   )   What is the result?()  A、 Errors at lines 7 and 8 cause compilation to fail.B、 The program prints pairs of values for x and y that might not always be the same on the same line  (for example, “x=2, y=1”).C、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by  “x=1, y=1”).D、 The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears only for once (for example, “x=1, y=1”  followed by “x=2, y=2”).

public class X {   public static void main (Stringargs) {   int a = new int [1]   modify(a);   System.out.printIn(a[0]);   }   public static void modify (int a) {   a[0] ++;    }    }   What is the result?()  A、 The program runs and prints “0”B、 The program runs and prints “1”C、 The program runs but aborts with an exception.D、 An error “possible undefined variable” at line 4 causes compilation to fail.E、 An error “possible undefined variable” at line 9 causes compilation to fail.

public class Test {  public static void leftshift(int i, int j) {  i=j;  }  public static void main(String args[])  {  int i = 4, j = 2;  leftshift(i, j);   System.out.printIn(i); }  }     What is the result?()  A、 2B、 4C、 8D、 16E、 The code will not compile.

public class X {   public static void main (Stringargs) {   String s1 = new String (“true”);   Boolean b1 = new Boolean (true);   if (s2.equals(b1)) {   System.out.printIn(“Equal”);   }   }   }   What is the result? () A、 The program runs and prints nothing.B、 The program runs and prints “Equal”C、 An error at line 5 causes compilation to fail.D、 The program runs but aborts with an exception.

public class X {  public static void main (String[]args)  {  String s1 = new String (“true”);  Boolean b1 = new Boolean (true);  if (s2.equals(b1))   {  System.out.printIn(“Equal”);  }  }  }      What is the result?()  A、 The program runs and prints nothing.B、 The program runs and prints “Equal”C、 An error at line 5 causes compilation to fail.D、 The program runs but aborts with an exception.

class super {   public int getLength() {return 4;}    }   public class Sub extends Super {   public long getLength() {return 5;}   public static void main (Stringargs) {   super sooper = new Super ();  Sub sub = new Sub();   System.out.printIn(   sooper.getLength()+ “,” + sub.getLength() };   }   What is the output?() A、 4, 4B、 4, 5C、 5, 4D、 5, 5E、 The code will not compile.

public class IfTest (  public static void main(string[]args) {  int x = 3;  int y = 1;  if (x = y)  system.out.printIn(“Not equal”);  else  system.out.printIn(“Equal”);  }  )   What is the result?()      A、 The output is “Equal”B、 The output in “Not Equal”C、 An error at line 5 causes compilation to fall.D、 The program executes but does not print a message.

import java.io.IOException;   public class ExceptionTest(   public static void main (Stringargs)  try (   methodA();   ) catch (IOException e) (   system.out.printIn(“Caught IOException”);  ) catch (Exception e) (   system.out.printIn(“Caught Exception”);   )   )   public void methodA () {   throw new IOException ();  }     What is the result?()  A、 The code will not compile.B、 The output is caught exception.C、 The output is caught IOException.D、 The program executes normally without printing a message.

public class SwitchTest {   public static void main (String args) {   System.out.PrintIn(“value =” +switchIt(4));   }   public static int switchIt(int x) {   int j = 1;   switch (x) {   case 1: j++;   case 2: j++;   case 3: j++;  case 4: j++;   case 5: j++;   default:j++;   }   return j + x;   }   }   What is the output from line 3? ()A、 Value = 3B、 Value = 4C、 Value = 5D、 Value = 6E、 Value = 7F、 Value = 8

public class IfTest (   public static void main(stringargs) {   int x = 3;  int y = 1;   if (x = y)   system.out.printIn(“Not equal”);   else   system.out.printIn(“Equal”);   }   )   What is the result?()A、 The output is “Equal”B、 The output in “Not Equal”C、 An error at line 5 causes compilation to fall.D、 The program executes but does not print a message.

public class Test {  public static void main(String[] args) {  int x = 0;  assert (x  0): “assertion failed”;  System.out.println(“finished”);  }  }  What is the result?()  A、 finishedB、 Compilation fails.C、 An AssertionError is thrown.D、 An AssertionError is thrown and finished is output.

单选题public class SwitchTest {   public static void main (String args) {   System.out.PrintIn(“value =” +switchIt(4));   }   public static int switchIt(int x) {   int j = 1;   switch (x) {   case 1: j++;   case 2: j++;   case 3: j++;  case 4: j++;   case 5: j++;   default:j++;   }   return j + x;   }   }   What is the output from line 3? ()A Value = 3B Value = 4C Value = 5D Value = 6E Value = 7F Value = 8

单选题public class X {   public static void main (Stringargs) {   String s1 = new String (“true”);   Boolean b1 = new Boolean (true);   if (s2.equals(b1)) {   System.out.printIn(“Equal”);   }   }   }   What is the result? ()A The program runs and prints nothing.B The program runs and prints “Equal”C An error at line 5 causes compilation to fail.D The program runs but aborts with an exception.

单选题public class X {  public static void main (String[]args)  {  String s1 = new String (“true”);  Boolean b1 = new Boolean (true);  if (s2.equals(b1))   {  System.out.printIn(“Equal”);  }  }  }      What is the result?()A The program runs and prints nothing.B The program runs and prints “Equal”C An error at line 5 causes compilation to fail.D The program runs but aborts with an exception.

单选题public class IfTest (  public static void main(string[]args) {  int x = 3;  int y = 1;  if (x = y)  system.out.printIn(“Not equal”);  else  system.out.printIn(“Equal”);  }  )   What is the result?()A The output is “Equal”B The output in “Not Equal”C An error at line 5 causes compilation to fall.D The program executes but does not print a message.

单选题public class IfTest (   public static void main(stringargs) {   int x = 3;  int y = 1;   if (x = y)   system.out.printIn(“Not equal”);   else   system.out.printIn(“Equal”);   }   )   What is the result?()A The output is “Equal”B The output in “Not Equal”C An error at line 5 causes compilation to fall.D The program executes but does not print a message.

单选题public class X implements Runnable(    private int x;   private int y;   public static void main(Stringargs)  X that = new X();   (new Thread(that)).start();  (new Thread(that)).start();  )  public void run() (  for (;;) (  x++;   y++;   System.out.printIn(“x=” + x + “, y = ” + y);   )   )   What is the result?()A Errors at lines 7 and 8 cause compilation to fail.B The program prints pairs of values for x and y that might not always be the same on the same line  (for example, “x=2, y=1”).C The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears twice (for example, “x=1, y=1” followed by  “x=1, y=1”).D The program prints pairs of values for x and y that are always the same on the same line (for example, “x=1, y=1”. In addition, each value appears only for once (for example, “x=1, y=1”  followed by “x=2, y=2”).

单选题public class WhileFoo {  public static void main (String []args)   {  int x= 1, y = 6;  while (y--)  {x--;}  system.out.printIn(“x=” + x “y =” + y);  }  }   What is the result?()A The output is x = 6 y = 0B The output is x = 7 y = 0C The output is x = 6 y = -1D The output is x = 7 y = -1E Compilation will fail.

单选题public class Test {  public static void leftshift(int i, int j) {  i=j;  }  public static void main(String args[])  {  int i = 4, j = 2;  leftshift(i, j);   System.out.printIn(i); }  }     What is the result?()A 2B 4C 8D 16E The code will not compile.

填空题Public class test (  Public static void main (String args[])  (  System.out.printIn (6 ^ 3);  )  )   What is the output?()

单选题class super {   public int getLength() {return 4;}    }   public class Sub extends Super {   public long getLength() {return 5;}   public static void main (Stringargs) {   super sooper = new Super ();  Sub sub = new Sub();   System.out.printIn(   sooper.getLength()+ “,” + sub.getLength() };   }   What is the output?()A 4, 4B 4, 5C 5, 4D 5, 5E The code will not compile.

单选题import java.io.IOException;   public class ExceptionTest(   public static void main (Stringargs)  try (   methodA();   ) catch (IOException e) (   system.out.printIn(“Caught IOException”);  ) catch (Exception e) (   system.out.printIn(“Caught Exception”);   )   )   public void methodA () {   throw new IOException ();  }     What is the result?()A The code will not compile.B The output is caught exception.C The output is caught IOException.D The program executes normally without printing a message.

单选题public class X {   public static void main (Stringargs) {   int a = new int [1]   modify(a);   System.out.printIn(a[0]);   }   public static void modify (int a) {   a[0] ++;    }    }   What is the result?()A The program runs and prints “0”B The program runs and prints “1”C The program runs but aborts with an exception.D An error “possible undefined variable” at line 4 causes compilation to fail.E An error “possible undefined variable” at line 9 causes compilation to fail.