易搜题 > 资格证大类 > 计算机编程 > 问题详情
问题详情

//point X    public class foo (   public static void main (Stringargs) throws Exception {   printWriter out = new PrintWriter (new )  java.io.outputStreamWriter (System.out), true;   out.printIn(“Hello”);    }   )   Which statement at PointX on line 1 allows this code to compile and run?()

A、 Import java.io.PrintWriter;

B、 Include java.io.PrintWriter;

C、 Import java.io.OutputStreamWriter;

D、 Include java.io.OutputStreamWriter;

E、 No statement is needed.

未找到的试题在搜索页框底部可快速提交,在会员中心"提交的题"查看可解决状态。 收藏该题
查看答案

相关问题推荐

  • Which two declarations prevent the overriding of a method?() 

    A

     Final void methoda() {}

    B

     Void final methoda() {}

    C

     Static void methoda() {}

    D

     Static final void methoda() {}

    E

     Final abstract void methoda() {}

  • 11. class Payload {  12. private int weight;  13. public Payload(int wt) { weight = wt; }  13. public void setWeight(mt w) { weight = w; }  15. public String toString { return Integer.toString(weight); }  16. }  17.  18. public class TestPayload {  19. static void changePayload(Payload p) { 20. /* insert code here */ 21. }  22.  23. public static void main(String[] args) {  24. Payload p = new Payload();  25. p.setWeight(1024);  26. changePayload(p);  27. System.out.println(”The value of p is “+ p);  28. }  29. }  Which statement, placed at line 20, causes the code to print “The value of p is 420.”?() 

    A、 p.setWeight(420);

    B、 p.changePayload(420);

    C、 p = new Payload(420);

    D、 Payload.setWeight(420);

    E、 p = Payload.setWeight(420);

    F、 p = new Payload(); p.setWeight(420);

  • 1.public class Test {  2.public static void main (String args[]) {  3.class Foo {  4.public int i = 3;  5.}  6.Object o = (Object) new Foo();  7.Foo foo = (Foo)o;  8.System.out.printIn(foo. i); 9. }  10.}   What is the result?()  

    A、 Compilation will fail.

    B、 Compilation will succeed and the program will print “3”

    C、 Compilation will succeed but the program will throw a ClassCastException at line 6.

    D、 Compilation will succeed but the program will throw a ClassCastException at line 7.

  • A class design requires that a member variable cannot be accessible directly outside the class. Which modifier should be used to obtain the access control?()    

    A、 public

    B、 no modifier

    C、 protected

    D、 private

  • Which two code fragments are most likely to cause a StackOverflowError?()

    A

    A

    B

    B

    C

    C

    D

    D

    E

    E

    F

    F

联系客服 会员中心
TOP