单选题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;  }  }   上述程序运行后的输出是哪项?()A4B14C41D以上都不对

题目
单选题
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

 4

B

 14

C

 41

D

 以上都不对


相似考题
更多“public class TestApp{   public int mymethod(){   try{   int ”相关问题
  • 第1题:

    在下列源代码文件Test.java中, ( )是正确的类定义。

    A.public class test{

    B.public class Test{ public int x=0;public int x=0; public test (intx) public Test (int x){ {this.x=x; this.x=x;} }} }

    C.public class Test extends T1,T2{

    D.protected class Test extends T2{ public int=0;public int x=0; public Test(int x){Public Test (int x){ this.x=x;this.x=x: }} }}


    正确答案:B

  • 第2题:

    给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test {  public void cal(int x, int y, int z) { } //A } 

    • A、public int cal(int x,int y,float z){return 0;}
    • B、public int cal(int x,int y,int z){return 0;}
    • C、public void cal(int x,int z){}
    • D、public viod cal(int z,int y,int x){}

    正确答案:A,C

  • 第3题:

    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

    正确答案:B

  • 第4题:

    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、 4
    • B、 14
    • C、 41
    • D、 以上都不对

    正确答案:A

  • 第5题:

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

    • A、0123
    • B、012456789
    • C、0123456789
    • D、012

    正确答案:D

  • 第6题:

    public class Parent {  public int addValue( int a, int b) {     int s;     s = a+b;     return s;     }     }  class Child extends Parent {  }  Which methods can be added into class Child?()   

    • A、 int addValue( int a, int b ){// do something...}
    • B、 public void addValue (){// do something...}
    • C、 public int addValue( int a ){// do something...}
    • D、 public int addValue( int a, int b )throws MyException {//do something...}

    正确答案:B,C

  • 第7题:

    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 */ } }

    正确答案:B,E

  • 第8题:

    单选题
    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

     4

    B

     14

    C

     41

    D

     以上都不对


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

  • 第9题:

    多选题
    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 */ } }


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

  • 第10题:

    单选题
    程序:  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

     14

    B

     编译错误

    C

     120

    D

     24


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

  • 第11题:

    多选题
    现有:  public  class  TestDemo{     private int X-2;      static int y=3;  public  void method(){      final int i=100;      int j  =10;     class Cinner {  public void mymethod(){      //Here     }     }     }     } 在Here处可以访问的变量是哪些?()
    A

    X

    B

    y

    C

    j

    D

    i


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

  • 第12题:

    多选题
    public class TestDemo{   private int x = 2;   static int y = 3;   public void method(){   final int i=100;   int j = 10;   class Cinner{   public void mymethod(){  //Here  }  }  }  }   在Here处可以访问的变量是哪些?()
    A

    x

    B

    y

    C

    i

    D

    j


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

  • 第13题:

    在下列源代码文件Test.java中,哪个选项是正确的类定义? ( )

    A.public class test { public int x=0; public test(int x) { this.x=x; } }

    B.public class Test { public int x=0; public Test(int x) { this.x=x; } }

    C.public class Test extends Ti,T2 { public int x=0; public Test(int x) { this.x=x; } }

    D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }


    正确答案:B

  • 第14题:

    程序:  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、 14
    • B、 编译错误
    • C、 120
    • D、 24

    正确答案:C

  • 第15题:

    The following methods are to be published as Web services to be invoked via SOAP messages and validated with a schema:  public void myMethod(int x, float y);  public void myMethod(int x);  public void someOtherMethod(int x, float y);  Which WSDL style should be used?()

    • A、 RPC/literal
    • B、 RPC/encoded
    • C、 Document/encoded
    • D、 Document/literal
    • E、 Document/literal wrapped

    正确答案:A

  • 第16题:

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

    • A、 3
    • B、 2
    • C、 231
    • D、 32

    正确答案:A

  • 第17题:

    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 {}

    正确答案:D

  • 第18题:

    public class Parent {     int change() {…}     }  class Child extends Parent {     }  Which methods can be added into class Child?()    

    • A、 public int change(){}
    • B、 int chang(int i){}
    • C、 private int change(){}
    • D、 abstract int chang(){}

    正确答案:A,B

  • 第19题:

    单选题
    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


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

  • 第20题:

    单选题
    The following methods are to be published as Web services to be invoked via SOAP messages and validated with a schema:  public void myMethod(int x, float y);  public void myMethod(int x);  public void someOtherMethod(int x, float y);  Which WSDL style should be used?()
    A

     RPC/literal

    B

     RPC/encoded

    C

     Document/encoded

    D

     Document/literal

    E

     Document/literal wrapped


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

  • 第21题:

    单选题
    public class Parent{     public void change(int x){} }  public class Child extends Parent{     //覆盖父类change方法  }  下列哪个声明是正确的覆盖了父类的change方法?()
    A

     protected void change(int x){}

    B

     public void change(int x, int y){}

    C

     public void change(String s){}

    D

     public void change(int x){}


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

  • 第22题:

    单选题
    public class Score implements Comparable {  private int wins, losses;  public Score(int w, int 1) { wins = w; losses = 1; }  public int getWins() { return wins; }  public int getLosses() { return losses; }  public String toString() {  return “”; }  // insert code here  }  Which method will complete this class?()
    A

     public int compareTo(Object o) {/*mode code here*/}

    B

     public int compareTo(Score other) {/*more code here*/}

    C

     public int compare(Score s1,Score s2){/*more code here*/}

    D

     public int compare(Object o1,Object o2){/*more code here*/}


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

  • 第23题:

    单选题
    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 {}


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

  • 第24题:

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

    0123

    B

    012456789

    C

    0123456789

    D

    012


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