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

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

现有: class TestApp{ public static void main (String[] args){ int [5] myarray={ 10, 11, 12, 13, 14); int sum=0; for (int x : myarray) sum+=x; System. out. println( "sum= "+sum); } } 上述程序运行后的结果是哪项?()

  • A、sum=10
  • B、sum=70
  • C、sum=60
  • D、运行时抛出异常

参考答案

更多 “ 现有: class TestApp{ public static void main (String[] args){ int [5] myarray={ 10, 11, 12, 13, 14); int sum=0; for (int x : myarray) sum+=x; System. out. println( "sum= "+sum); } } 上述程序运行后的结果是哪项?()A、sum=10B、sum=70C、sum=60D、运行时抛出异常” 相关考题
考题 public class Yippee2{stati cpublic void main(String[]yahoo){for(intx=1;xSystem.out.print(yahoo[x]+);}}}and the command line invocation:java Yippee2 a b cWhat is the result?() A.abB.bcC.abcD.Compilation fails.E.An exception is thrown at runtime.

考题 程序:  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;i10;i++){   if(i==3)   break;   System.out.print (i);  }  }  }   程序运行后的输出是哪项?()  A、0123B、012C、0123456789D、012456789

考题 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 Yippee2{ stati cpublic void main(String[]yahoo){ for(intx=1;xA、abB、bcC、abcD、Compilation fails.E、An exception is thrown at runtime.

考题 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、 以上都不对

考题 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

考题 现有:     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

考题 现有:  interface Data {public void load();}  abstract class Info {public abstract void load();}      下列类定义中正确使用Data和Info的是哪项?() A、 public class Employee implements Info extends Data { public void load(){/*dosomething*/}     }B、public class Employee extends Inf.implements Data{ public void load() {/*do something*/}     }C、public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/}     public void load(){/*do something*/}     }D、public class Employee extends Inf implements Data  {  public void Data.1oad()  {/*do something*/)     public void info.1oad(){/*do something*/}    }

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

考题 现有:      class TestA  {  public void start()  {  System.out.println("TestA");  }     }  public class TestB extends TestA  {  public void start()  {  System.out.println("TestB");  }     public static void main (string[]  args)  (     ((TestA)new TestB()).start();     )     }  运行结果是哪项?()     A、  TeStAB、  TeStBC、编译失败D、运行时抛出异常

考题 现有      public class Parentt      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 (int x){}D、  public void change (String s){}

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

考题 单选题现有:  interface Data {public void load();}  abstract class Info {public abstract void load();}      下列类定义中正确使用Data和Info的是哪项?()A  public class Employee implements Info extends Data { public void load(){/*dosomething*/}     }B public class Employee extends Inf.implements Data{ public void load() {/*do something*/}     }C public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/}     public void load(){/*do something*/}     }D public class Employee extends Inf implements Data  {  public void Data.1oad()  {/*do something*/)     public void info.1oad(){/*do something*/}    }

考题 单选题程序:  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);     }     }     }  程序运行后的输出是哪项?()A 0123B 012456789C   0123456789D   012

考题 单选题现有      public class Parentt      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 (int x){}D   public void change (String s){}

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

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

考题 单选题现有: class TestApp{ public static void main (String[] args){ int [5] myarray={ 10, 11, 12, 13, 14); int sum=0; for (int x : myarray) sum+=x; System. out. println( "sum= "+sum); } } 上述程序运行后的结果是哪项?()A sum=10B sum=70C sum=60D 运行时抛出异常

考题 单选题现有:      class TestA  {  public void start()  {  System.out.println("TestA");  }     }  public class TestB extends TestA  {  public void start()  {  System.out.println("TestB");  }     public static void main (string[]  args)  (     ((TestA)new TestB()).start();     )     }  运行结果是哪项?()A   TeStAB   TeStBC 编译失败D 运行时抛出异常

考题 多选题现有:  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处可以访问的变量是哪些?()AXByCjDi

考题 单选题现有:  interface Animal {       void eat () ;       }       //insert code here       public class HouseCat extends Feline {       public void eat() { }       }  和五个申明  abstract class Feline implements Animal { }  abstract  class  Feline  implements  Animal  {  void eat () ;  }  abstract class Feline implements Animal { public void eat();}  abstract class Feline implements Animal { public void eat() {}  }  abstract class Feline implements Animal { abstract public void eat();} 结果为:()A 1B 2C 3D 4

考题 单选题public class Yippee2{ stati cpublic void main(String[]yahoo){ for(intx=1;x A abB bcC abcD Compilation fails.E An exception is thrown at runtime.

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