public class TestApp{   public static void main(String[] args){   try{   int i = 0;   int j = 1 / i;   System.out.println(“1”);   } catch(Exception e){   System.out.print(“3”);   } finally{   System.out.print(“4”);   }   }   }   上述程序运行后的输出是哪项?() A、 4B、 34C、 43D、 14

public class TestApp{   public static void main(String[] args){   try{   int i = 0;   int j = 1 / i;   System.out.println(“1”);   } catch(Exception e){   System.out.print(“3”);   } finally{   System.out.print(“4”);   }   }   }   上述程序运行后的输出是哪项?() 

  • A、 4
  • B、 34
  • C、 43
  • D、 14

相关考题:

下列程序片段中,能通过编译的是A.public abstract class Animal{ public void speak();}B.public abstract class Animal{ public void speak(){}}C.public class Animal{ public abstract void speak();}D.public abstract class Animal{ public abstract void speak(){}}

下列虚基类的声明中正确的是( )。A.class virtual B:public AB.virtual class B:public AC.class B:public A virtualD.class B:virtual public A

Given:Which two, inserted at line 11, will allow the code to compile?() A.public class MinMax? {B.public class MinMax? extends Number {C.public class MinMaxN extends Object {D.public class MinMaxN extends Number {E.public class MinMax? extends Object {F.public class MinMaxN extends Integer {

public class SomeException {  } Class a:  public class a {  public void doSomething() { }  } Class b:  public class b extends a {  public void doSomething() throws SomeException { }  }  Which is true about the two classes?() A、 Compilation of both classes will fail.B、 Compilation of both classes will succeed.C、 Compilation of class a will fail. Compilation of class b will succeed.D、 Compilation of class a will fail. Compilation of class a will succeed.

程序:  class  TestApp{  public static void main(String[] args){  System.out.println(multiply(2,3,4,5));  }  public int multiply(int[] nums){       int result = 1;       for(int x :nums)           result *= x;       return result;   } }  程序运行后的输出是哪项?() A、 14B、 编译错误C、 120D、 24

Which three demonstrate an “is a” relationship?() A、 public class X { }  public class Y extends X { }B、 public interface Shape { }  public interface Rectangle extends Shape{ }C、 public interface Color { }  public class Shape { private Color color; }D、 public interface Species { }  public class Animal { private Species species; }E、 public class Person { } public class Employee {  public Employee(Person person) { }F、 interface Component { }  class Container implements Component { private Component[] children; }

public class TestApp{   public int mymethod(){   try{   int i = 0;   int j = 1 / i;   System.out.println(“1”);   }finally{   System.out.print(“4”);  }   return 1;  }  }   上述程序运行后的输出是哪项?() A、 4B、 14C、 41D、 以上都不对

interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?() A、 public class Employee extends Info implements Data { public void load() { /*do something*/ } }B、 public class Employee implements Info extends Data { public void load() { /*do something*/ } }C、 public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D、 public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E、 public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F、 public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

Which two allow the class Thing to be instantiated using new Thing()?A、 public class Thing { }B、 public class Thing { public Thing() {} }C、 public class Thing { public Thing(void) {} }D、 public class Thing { public Thing(String s) {} }E、 public class Thing { public void Thing() {} public Thing(String s) {} }

现有: class TestApp{ public static void main (String[] args){ for (int i=0; iA、0123B、012456789C、0123456789D、012

package geometry;  public class Hypotenuse {  public InnerTriangle it = new InnerTriangle();  class InnerTriangle {  public int base;  public int height;  }  }  Which is true about the class of an object that can reference the variable base? ()A、 It can be any class.B、 No class has access to base.C、 The class must belong to the geometry package.D、 The class must be a subclass of the class Hypotenuse.

现有:     class TestApp{  public  static  void main (String[]  args){      for (int  i=0; iif(i==3)      break;  System. out .print (i);     }     }     }  程序运行后的输出是哪项?()      A、0123B、012456789C、  0123456789D、  012

Which the two demonstrate an “is a” relationship?()A、 public interface Person {}  Public class Employee extends Person {}B、 public interface Shape {}  public interface Rectangle extends Shape {}C、 public interface Color {}  public class Shape { private Color color; }D、 public class Species {}  public class Animal { private Species species; }E、 interface Component {} Class Container implements Component {private Component [] children;

Which two demonstrate an “is a” relationship?()   A、 public interface Person { }  public class Employee extends Person { }B、 public interface Shape { }  public class Employee extends Shape { }C、 public interface Color { }  public class Employee extends Color { }D、 public class Species { }  public class Animal (private Species species;)E、 interface Component { }  Class Container implements Component ( Private Component[ ]children;  )

What produces a compiler error?()  A、 class A { public A(int x) {} }B、 class A {} class B extends A { B() {} }C、 class A { A() {} } class B { public B() {} }D、 class Z { public Z(int) {} } class A extends Z {}

public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()A、 public class Circle implements Shape { private int radius; }B、 public abstract class Circle extends Shape { private int radius; }C、 public class Circle extends Shape { private int radius; public void draw(); }D、 public abstract class Circle implements Shape { private int radius; public void draw(); }E、 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }F、 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

单选题public class TestApp{   public static void main(String[] args){   try{   int i = 0;   int j = 1 / i;   System.out.println(“1”);   } catch(Exception e){   System.out.print(“3”);   } finally{   System.out.print(“4”);   }   }   }   上述程序运行后的输出是哪项?()A 4B 34C 43D 14

单选题程序:  class  TestApp{  public static void main(String[] args){   for(int i=0;i10;i++){  if(i==3)                    break;   System.out.print(i);  }      }  }  程序运行后的输出是哪项?()A 0123B 012C 0123456789D 012456789

单选题interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?()A public class Employee extends Info implements Data { public void load() { /*do something*/ } }B public class Employee implements Info extends Data { public void load() { /*do something*/ } }C public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }D public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }E public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }F public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

多选题Which three demonstrate an “is a” relationship?()Apublic class X { }  public class Y extends X { }Bpublic interface Shape { }  public interface Rectangle extends Shape{ }Cpublic interface Color { }  public class Shape { private Color color; }Dpublic interface Species { }  public class Animal { private Species species; }Epublic class Person { } public class Employee {  public Employee(Person person) { }Finterface Component { }  class Container implements Component { private Component[] children; }

单选题public class SomeException {  } Class a:  public class a {  public void doSomething() { }  } Class b:  public class b extends a {  public void doSomething() throws SomeException { }  }  Which is true about the two classes?()A Compilation of both classes will fail.B Compilation of both classes will succeed.C Compilation of class a will fail. Compilation of class b will succeed.D Compilation of class a will fail. Compilation of class a will succeed.

多选题Which two allow the class Thing to be instantiated using new Thing()?Apublic class Thing { }Bpublic class Thing { public Thing() {} }Cpublic class Thing { public Thing(void) {} }Dpublic class Thing { public Thing(String s) {} }Epublic class Thing { public void Thing() {} public Thing(String s) {} }

单选题程序:  class  TestApp{  public static void main(String[] args){  System.out.println(multiply(2,3,4,5));  }  public int multiply(int[] nums){       int result = 1;       for(int x :nums)           result *= x;       return result;   } }  程序运行后的输出是哪项?()A 14B 编译错误C 120D 24

单选题现有:     class TestApp{  public  static  void main (String[]  args){      for (int  i=0; iif(i==3)      break;  System. out .print (i);     }     }     }  程序运行后的输出是哪项?()A0123B012456789C  0123456789D  012

单选题class TestApp{   public static void main (String[ ] args){   for(int i=0;i10;i++){   if(i==3)   break;   System.out.print (i);  }  }  }   程序运行后的输出是哪项?()A0123B012C0123456789D012456789

单选题public class TestApp{  public static void main(String[] args){        try{  String myname = null;           if(myname.length()2)              System.out.print(“1”);        }catch(NullPointerException e){              System.out.print(“2”);       }   } }  上述程序运行后的输出是哪项?()A 1B 12C 21D 2

单选题What produces a compiler error?()A class A { public A(int x) {} }B class A {} class B extends A { B() {} }C class A { A() {} } class B { public B() {} }D class Z { public Z(int) {} } class A extends Z {}

单选题现有: class TestApp{ public static void main (String[] args){ for (int i=0; iA0123B012456789C0123456789D012