网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

public class Pass {  public static void main(String [1 args) {  int x 5;  Pass p = new Pass();  p.doStuff(x);  System.out.print(” main x = “+ x);  }  void doStuff(int x) {  System.out.print(” doStuff x = “+ x++);  }  }  What is the result?() 

  • A、 Compilation fails.
  • B、 An exception is thrown at runtime.
  • C、 doStuffx = 6 main x = 6
  • D、 doStuffx = 5 main x = 5
  • E、 doStuffx = 5 main x = 6
  • F、 doStuffx = 6 main x = 5

参考答案

更多 “ public class Pass {  public static void main(String [1 args) {  int x 5;  Pass p = new Pass();  p.doStuff(x);  System.out.print(” main x = “+ x);  }  void doStuff(int x) {  System.out.print(” doStuff x = “+ x++);  }  }  What is the result?() A、 Compilation fails.B、 An exception is thrown at runtime.C、 doStuffx = 6 main x = 6D、 doStuffx = 5 main x = 5E、 doStuffx = 5 main x = 6F、 doStuffx = 6 main x = 5” 相关考题
考题 若有如下程序:public class Test {public static void main (String[] args) {int x=20;if (x>10) System.out.print(x-=5);if (x>5) System.out.print(x--);}}则程序运行后的输出结果是【 】。

考题 public class Pass{public static void main(String[]args){int x=5;Pass p=new Pass();p.doStuff(x);System.out.print(mainx=+x);}void doStuff(intx){System.out.print(doStuffx=+x++);}}What is the result?()A.Compilation fails.B.An exception is thrown at runtime.C.doStuff x=6 main x=6D.doStuff x=5 main x=5E.doStuff x=5 main x=6F.doStuff x=6 main x=5

考题 Given the command line java Pass2 and:public class Pass2{public void main(String[]args){int x=6;Pass2 p=new Pass2();p.doStuff(x);System.out.print(mainx=+x);}void doStuff(intx){System.out.print(doStuffx=+x++);}}What is the result?()A.Compilation fails.B.An exception is thrown at runtime.C.doStuffx=6 main x=6D.doStuffx=6 mainx =7E.doStuffx=7 mainx =6F.doStuffx=7 mainx =7

考题 下列程序执行后的结果为______。 public class exl2 { public static void main(string[] args) { int n=4; int x=0; do{ System.out.print(n); }while (x++<n--); } }A.12B.432C.43D.4

考题 interface A{int x = 0;}class B{int x =1;}class C extends B implements A {public void pX(){System.out.println(x);}public static void main(String[] args) {new C().pX();}}

考题 以下程序调试结果为:public class Test {int m=5;public void some(int x) {m=x;}public static void main(String args []) {new Demo().some(7);}}class Demo extends Test {int m=8;public void some(int x) {super.some(x);System.out.println(m);}}A.5B.8C.7D.无任何输出E.编译错误

考题 现有:  class Passer f  static final int X=5;  public  static void main (String  []  args)  {      new  Passer().go (x);      System. out .print (x);      }  void go (int x)  {     System. out .print(x++);     }     结果是什么?()     A、55B、56C、65D、66

考题 程序:  class TestReference{  public static void main(String[] args){   int x=2;  TestReference tr = new TestReference();          System.out.print(x);          tr.change(x);  System.out.print(x);  }  public void change(int num){      num = num + 1; } }  程序运行后的输出是哪项?()  A、 23B、 21C、 22D、 编译错误

考题 interface DeclareStuff{  public static final int EASY = 3;  void doStuff(int t); }  public class TestDeclare implements DeclareStuff {  public static void main(String [] args) {  int x=5;  new TestDeclare().doStuff(++x);  }  void doStuff(int s) {  s += EASY + ++s;  System.out.println(”s “ + s);  }  }  What is the result?() A、 s 14B、 s 16C、 s 10D、 Compilation fails.E、 An exception is thrown at runtime.

考题 class Foo {  private int x;  publicFoo(intx) {this.x=x; }  public void setX( int x) { this.x = x; }  public int getX() { return x; }  }   public class Gamma {  static Foo fooBar( Foo foo) {  foo = new Foo( 100);  return foo;  }  public static void main( String[] args) {  Foo foo = new Foo( 300);  System.out.print( foo.getX() + “-“);  Foo fooFoo = fooBar( foo);  System.out.print( foo.getX() + “-“);  System.out.print( fooFoo.getX() + “-“);  foo = fooBar( fooFoo);  System.out.print( foo.getX() + “-“);  System.out.prmt( fooFoo.getX());  }  }  What is the output of this program?()A、 300-100-100-100-100B、 300-300-100-100-100C、 300-300-300-100-100D、 300-300-300-300-100

考题 Given the command line java Pass2 and:  public class Pass2 {  public void main(String [] args) {  int x=6;  Pass2 p = new Pass2();  p.doStuff(x);  System.out.print(” main x = “+ x); }  void doStuff(int x) {  System.out.print(” doStuffx = “+ x++);  }  }  What is the result?() A、 Compilation fails.B、 An exception is thrown at runtime.C、 doStuffx = 6 main x = 6D、 doStuffx = 6 main x = 7E、 doStuffx = 7 main x = 6F、 doStuffx = 7 main x = 7

考题 public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”); }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }   public static void badMethod() {} }  What is the result?()  A、 ACB、 BDC、 ACDD、 ABCDE、 Compilation fails.

考题 public class Yippee {  public static void main(String [] args) {  for(int x = 1; x  args.length; x++) {  System.out.print(args[x] +“ “);  }  }  }  and two separate command line invocations:  java Yippee  java Yippee 1234  What is the result?() A、 No output is produced. 123B、 No output is produced. 234C、 No output is produced. 1234D、 An exception is thrown at runtime. 123E、 An exception is thrown at runtime. 234F、 An exception is thrown at rijntime. 1234

考题 class Top {  static int x = 1;  public Top(int y) { x *= 3; }  }  class Middle extends Top {  public Middle() { x += 1; }  public static void main(String [] args) {  Middle m = new Middle();  System.out.println(x);  }  }  结果为:() A、1B、2C、3D、编译失败

考题 class Passer {  static final int x = 5;  public static void main(String [] args) { new Passer().go(x);  System.out.print(x);  }  void go(int x) {  System.out.print(++x);  }  }  结果是什么?() A、55B、56C、65D、66

考题 class Beverage {   Beverage() { System.out.print("beverage "); }   }   class Beer extends Beverage {   public static void main(String [] args) {   Beer b = new Beer(14);   }   public int Beer(int x) {   this();   System.out.print("beer1 ");   }   public Beer() { System.out.print("beer2 "); }  }   结果是什么?()  A、beer1 beverageB、beer2 beverageC、beverage beer1D、编译失败

考题 public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (RuntimeException ex) {  System.out.print(“B”);  }  catch (Exception ex1) {  System.out.print(“C”);  }   finally {  System.out.print(“D”);  }  System.out.print(“E”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result?()  A、 BDB、 BCDC、 BDED、 BCDEE、 ABCDEF、 Compilation fails.

考题 public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result? () A、 ABB、 BCC、 ABCD、 BCDE、 Compilation fails.

考题 单选题public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (RuntimeException ex) {  System.out.print(“B”);  }  catch (Exception ex1) {  System.out.print(“C”);  }   finally {  System.out.print(“D”);  }  System.out.print(“E”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result?()A  BDB  BCDC  BDED  BCDEE  ABCDEF  Compilation fails.

考题 单选题public class Pass {  public static void main(String [1 args) {  int x 5;  Pass p = new Pass();  p.doStuff(x);  System.out.print(” main x = “+ x);  }  void doStuff(int x) {  System.out.print(” doStuff x = “+ x++);  }  }  What is the result?()A  Compilation fails.B  An exception is thrown at runtime.C  doStuffx = 6 main x = 6D  doStuffx = 5 main x = 5E  doStuffx = 5 main x = 6F  doStuffx = 6 main x = 5

考题 单选题Given the command line java Pass2 and:  public class Pass2 {  public void main(String [] args) {  int x=6;  Pass2 p = new Pass2();  p.doStuff(x);  System.out.print(” main x = “+ x); }  void doStuff(int x) {  System.out.print(” doStuffx = “+ x++);  }  }  What is the result?()A  Compilation fails.B  An exception is thrown at runtime.C  doStuffx = 6 main x = 6D  doStuffx = 6 main x = 7E  doStuffx = 7 main x = 6F  doStuffx = 7 main x = 7

考题 单选题public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”);  }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }  public static void badMethod() {  throw new RuntimeException();  }  }  What is the result? ()A  ABB  BCC  ABCD  BCDE  Compilation fails.

考题 单选题public class X {  public static void main(String [] args) {  try {  badMethod();  System.out.print(“A”); }  catch (Exception ex) {  System.out.print(“B”);  }  finally {  System.out.print(“C”);  }  System.out.print(“D”);  }   public static void badMethod() {} }  What is the result?()A  ACB  BDC  ACDD  ABCDE  Compilation fails.

考题 单选题class Passer {  static final int x = 5;  public static void main(String [] args) { new Passer().go(x);  System.out.print(x);  }  void go(int x) {  System.out.print(++x);  }  }  结果是什么?()A 55B 56C 65D 66

考题 单选题interface DeclareStuff{  public static final int EASY = 3;  void doStuff(int t); }  public class TestDeclare implements DeclareStuff {  public static void main(String [] args) {  int x=5;  new TestDeclare().doStuff(++x);  }  void doStuff(int s) {  s += EASY + ++s;  System.out.println(”s “ + s);  }  }  What is the result?()A  s 14B  s 16C  s 10D  Compilation fails.E  An exception is thrown at runtime.

考题 单选题程序:  class TestReference{  public static void main(String[] args){   int x=2;  TestReference tr = new TestReference();          System.out.print(x);          tr.change(x);  System.out.print(x);  }  public void change(int num){      num = num + 1; } }  程序运行后的输出是哪项?()A  23B  21C  22D  编译错误

考题 单选题public class Pass{ public static void main(String[]args){ int x=5; Pass p=new Pass(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()A Compilation fails.B An exception is thrown at runtime.C doStuff x=6 main x=6D doStuff x=5 main x=5E doStuff x=5 main x=6F doStuff x=6 main x=5