public class Alpha{  private static Character() ids;  public

题目
单选题
public class Alpha{  private static Character() ids;  public static void main( String[] args){  ids = new Character[args.length];  for (int i=0; iids[i] = new Character( args[i] );  System.out.print( ids[i] );  }  }  }   What is correct?()
A

 Compilation fails.

B

 The code runs with no output.

C

 An exception is thrown at runtime.

D

 The code runs, outputing a concatenated list of the arguments passed to the program.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

public class Alpha{  private static Character() ids;  public static void main( String[] args){  ids = new Character[args.length];  for (int i=0; iids[i] = new Character( args[i] );  System.out.print( ids[i] );  }  }  }   What is correct?()  

  • A、 Compilation fails.
  • B、 The code runs with no output.
  • C、 An exception is thrown at runtime.
  • D、 The code runs, outputing a concatenated list of the arguments passed to the program.

正确答案:A

第2题:

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

正确答案:A,B,F

第3题:

给出下列代码,如何使成员变量m被方法fun( )直接访问?Class Test{private int m;public static void fun( ){} }

A.将private int m改为protected int m

B.将private int m改为public int m

C.将private int m改为static int m

D.将private int m改为int m


正确答案:C

第4题:

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;

正确答案:B,E

第5题:

public class X {  public X aMethod() { return this;}  }  public class Y extends X {  }  Which two methods can be added to the definition of class Y?()

  • A、 public void aMethod() {}
  • B、 private void aMethod() {}
  • C、 public void aMethod(String s) {}
  • D、 private Y aMethod() { return null; }
  • E、 public X aMethod() { return new Y(); }

正确答案:C,E

第6题:

Which declaration prevents creating a subclass of an outer class?()

  • A、 Static class FooBar{}
  • B、 Private class FooBar{}
  • C、 Abstract public class FooBar{}
  • D、 Final public class FooBar{}
  • E、 Final abstract class FooBar{}

正确答案:D

第7题:

public class test (   private static int j = 0;     private static boolean methodB(int k) (  j += k;    return true;   )    public static void methodA(int i) {    boolean b:   b = i < 10 | methodB (4);    b = i < 10 || methodB (8);   )     public static void main (String args) } (    methodA (0);  system.out.printIn(j);   )    )   What is the result?()  

  • A、 The program prints “0”
  • B、 The program prints “4”
  • C、 The program prints “8”
  • D、 The program prints “12”
  • E、 The code does not complete.

正确答案:B

第8题:

1. public class Target {  2. private int i = 0;  3. public int addOne() {  4. return ++i;  5. }  6. }  And:  1. public class Client {  2. public static void main(String[] args) {  3. System.out.println(new Target().addOne());  4. }  5. }  Which change can you make to Target without affecting Client?() 

  • A、 Line 4 of class Target can be changed to return i++;
  • B、 Line 2 of class Target can be changed to private int i = 1;
  • C、 Line 3 of class Target can be changed to private int addOne() {
  • D、 Line 2 of class Target can be changed to private Integer i = 0;

正确答案:D

第9题:

public class OuterClass {  private double d1  1.0;  //insert code here   }   You need to insert an inner class declaration at line2. Which two inner class declarations are valid?() 

  • A、 static class InnerOne {  public double methoda() {return d1;}  }
  • B、 static class InnerOne {  static double methoda() {return d1;} }
  • C、 private class InnerOne {  public double methoda() {return d1;} }
  • D、 protected class InnerOne {  static double methoda() {return d1;} }
  • E、 public abstract class InnerOne {  public abstract double methoda();  }

正确答案:C,E

第10题:

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;  )

正确答案:D,E

更多相关问题