填空题5. String foo = “base”;   6. foo.substring(0,3);   7. foo.concat(“ket”)  8.   Type the value of foo at line 8.()

题目
填空题
5. String foo = “base”;   6. foo.substring(0,3);   7. foo.concat(“ket”)  8.   Type the value of foo at line 8.()

相似考题
更多“5. String foo = “base”;   6. foo.substring(0,3);   7. foo.co”相关问题
  • 第1题:

    3. string foo = “ABCDE”;  4. foo.substring(3);  5. foo.concat(“XYZ”);  6.     Type the value of foo at line 6.()


    正确答案:ABCDE

  • 第2题:

    1. class SuperFoo {  2. SuperFoo doStuff(int x) {  3. return new SuperFoo(); 4. }  5. }  6.  7. class Foo extends SuperFoo {  8. //insert code here  9. }   下面哪三项分别插入到第8行,可以编译?()

    • A、int doStuff() { return 42; }
    • B、int doStuff(int x) { return 42; }
    • C、Foo doStuff(int x) { return new Foo(); }
    • D、SuperFoo doStuff(int x) { return new Foo(); }

    正确答案:A,C,D

  • 第3题:

    现有:  1. abstract class Color  {  2.protected abstract  String getRGB();     3.  }     4.  5. public class Blue extends Color  {     6.    //insert code here      7.  }  和四个声明:  public String getRGB()  {  return "blue";  }      String getRGB()  {  return  "blue";  )  private  String getRGB()  {  return  "blue";  }      protected String getRGB()  {  return "blue";  )      分别插入到第6行,有几个可以通过编译?()    

    • A、  0
    • B、  1
    • C、  2
    • D、  3

    正确答案:C

  • 第4题:

    Given the JSP code: <% request.setAttribute("foo", "bar"); %>and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()

    • A、String x = (String) pageContext.getAttribute("foo")
    • B、String x = (String) pageContext.getRequestScope("foo")
    • C、It is NOT possible to access the pageContext object from within doStartTag
    • D、String x = (String) pageContext.getRequest().getAttribute("foo")
    • E、String x = (String) pageContext.getAttribute("foo", PageContext.ANY_SCOPE)

    正确答案:D

  • 第5题:

    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.

    正确答案:B

  • 第6题:

    单选题
    Which retrieves the value associated with “foo” from within an HttpServlet?()
    A

     String value = getServletConfig( ).getParameter(“foo”);

    B

     String value = getServletContext( ).getAttribute(“foo”);

    C

     Object value = getServletContext( ).getInitParameter(“foo”);

    D

     String value = getServletContext( ).getInitParameter(“foo”)


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

  • 第7题:

    填空题
    5. String foo = “base”;  6. foo.substring(0,3);  7. foo.concat(“ket”)  8.     Type the value of foo at line 8.()

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

  • 第8题:

    填空题
    3. string foo = “ABCDE”;  4. foo.substring(3);   5. foo.concat(“XYZ”);   6.   Type the value of foo at line 6.()

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

  • 第9题:

    单选题
    2. public class Foo implements Runnable (  3. public void run (Thread t) {  4. system.out.printIn(“Running.”);  5. }  6. public static void main (String[] args)  {  7. new thread (new Foo()).start(); 8. )  9. )   What is the result?()
    A

     An exception is thrown.

    B

     The program exists without printing anything.

    C

     An error at line 1 causes compilation to fail.

    D

     An error at line 6 causes the compilation to fail.

    E

     “Running” is printed and the program exits.


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

  • 第10题:

    单选题
    1. public class Employee {  2. String name;  3. double baseSalary;  4. Employee(String name, double baseSalary) {  5. this.name = name;  6. this.baseSalary = baseSalary;  7. }  8. }  And:  1. public class Salesperson extends Employee { 2. double commission;  3. public Salesperson(String name, double baseSalary,  4. double commission) {  5. // insert code here  6. } 7. }  Which code, inserted at line 7, completes the Salesperson constructor?()
    A

     this.commission = commission;

    B

     superb(); commission = commission;

    C

     this.commission = commission; superb();

    D

     super(name, baseSalary); this.commission = commission;

    E

     super(); this.commission = commission;

    F

     this.commission = commission; super(name, baseSalary);


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

  • 第11题:

    单选题
    public class Base {  public static final String FOO = “foo”;  public static void main(String[] args) {  Base b = new Base();  Sub s = new Sub();  System.out.print(Base.FOO);  System.out.print(Sub.FOO);  System.out.print(b.FOO);  System.out.print(s.FOO);  System.out.print(((Base)s).FOO);  } }  class Sub extends Base {public static final String FOO=bar;}  What is the result?()
    A

     foofoofoofoofoo

    B

     foobarfoobarbar

    C

     foobarfoofoofoo

    D

     foobarfoobarfoo

    E

     barbarbarbarbar

    F

     foofoofoobarbar

    G

     foofoofoobarfoo


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

  • 第12题:

    单选题
    Given the JSP code: and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()
    A

    String x = (String) pageContext.getAttribute(foo)

    B

    String x = (String) pageContext.getRequestScope(foo)

    C

    It is NOT possible to access the pageContext object from within doStartTag

    D

    String x = (String) pageContext.getRequest().getAttribute(foo)

    E

    String x = (String) pageContext.getAttribute(foo, PageContext.ANY_SCOPE)


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

  • 第13题:

    5. String foo = “base”;   6. foo.substring(0,3);   7. foo.concat(“ket”)  8.   Type the value of foo at line 8.()


    正确答案:BASE

  • 第14题:

    public class Test {  public static void main(String args[]) {  class Foo {  public int i = 3; }  Object o = (Object)new Foo();   Foo foo = (Foo)o;  System.out.println(“i = “ + foo.i); }  }  What is the result?()  

    • A、 i = 3
    • B、 Compilation fails.
    • C、 A ClassCastException is thrown at line 6.
    • D、 A ClassCastException is thrown at line 7.

    正确答案:A

  • 第15题:

    2. public class Foo implements Runnable (  3. public void run (Thread t) {  4. system.out.printIn(“Running.”);  5. }  6. public static void main (String[] args)  {  7. new thread (new Foo()).start(); 8. )  9. )   What is the result?()      

    • A、 An exception is thrown.
    • B、 The program exists without printing anything.
    • C、 An error at line 1 causes compilation to fail.
    • D、 An error at line 6 causes the compilation to fail.
    • E、 “Running” is printed and the program exits.

    正确答案:C

  • 第16题:

    1. interface TestA { String toString(); }  2. public class Test {  3. public static void main(String[] args) {  4. System.out.println(new TestA() {  5. public String toString() { return “test”; }  6. }  7. }  8. }  What is the result?() 

    • A、 test
    • B、 null
    • C、 An exception is thrown at runtime.
    • D、 Compilation fails because of an error in line 1.
    • E、 Compilation fails because of an error in line 4.
    • F、 Compilation fails because of an error in line 5.

    正确答案:A

  • 第17题:

    多选题
    1. class SuperFoo {  2. SuperFoo doStuff(int x) {  3. return new SuperFoo(); 4. }  5. }  6.  7. class Foo extends SuperFoo {  8. //insert code here  9. }   下面哪三项分别插入到第8行,可以编译?()
    A

    int doStuff() { return 42; }

    B

    int doStuff(int x) { return 42; }

    C

    Foo doStuff(int x) { return new Foo(); }

    D

    SuperFoo doStuff(int x) { return new Foo(); }


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

  • 第18题:

    单选题
    public class Test {   public static void main (String args) {   class Foo {   public int i = 3;  }   Object o = (Object) new Foo();   Foo foo = (Foo)o;   System.out.printIn(foo. i);  }   }   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.


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

  • 第19题:

    单选题
    1. interface foo {  2. int k = 0;  3. } 4.    5. public class test implements Foo (  6. public static void main(String args[]) (  7. int i;  8. Test test = new test ();  9. i= test.k;  10.i= Test.k;  11.i= Foo.k;  12.)  13.)  14.        What is the result?()
    A

     Compilation succeeds.

    B

     An error at line 2 causes compilation to fail.

    C

     An error at line 9 causes compilation to fail.

    D

     An error at line 10 causes compilation to fail.

    E

     An error at line 11 causes compilation to fail.


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

  • 第20题:

    单选题
    public class Test {  public static void main(String args[]) {  class Foo {  public int i = 3; }  Object o = (Object)new Foo();   Foo foo = (Foo)o;  System.out.println(“i = “ + foo.i); }  }  What is the result?()
    A

     i = 3

    B

     Compilation fails.

    C

     A ClassCastException is thrown at line 6.

    D

     A ClassCastException is thrown at line 7.


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

  • 第21题:

    单选题
    现有:  1.class SuperFoo{  2.SuperFoo doStuff (int x)  {      3.return new SuperFoo();      4.    }      5.  }      6.  7. class Foo extends SuperFoo  {     8.    //insert code here     9.  }  和四个声明:   Foo doStuff (int x)  {  return new Foo();  }  Foo doStuff (int x)  {  return new SuperFoo();  }      SuperFoo doStuff(int x)  {  return new Foo();  }  SuperFoo doStuff(int y)  {  return new SuperFoo();  }    分别插入到第8行,有几个可以通过编泽?()
    A

     1

    B

     2

    C

     3

    D

     4


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

  • 第22题:

    单选题
    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
    解析: 暂无解析

  • 第23题:

    填空题
    1. public class test {  2. public static string output = “”  3.    4. public static void foo(int i) {  5. try {  6. if(i= =1) {  7. throw new Exception ();  8. }  9. output += “1”;  10.}  11. catch(Exception e)  {  12. output += “2”;  13. return;  14.}  15. finally (  16. output += “3”;  17. )  18. output += “4”;  19. } 20.    21. public static void main (string args[])  (  22. foo(0);  23. foo(1);  24.    25. )  26. } What is the value of the variable output at line 24?()

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

  • 第24题:

    单选题
    Given the JSP code: and the Classic tag handler code: 5. public int doStartTag() throws JspException { 6. // insert code here 7. // return int 8. } Assume there are no other "foo" attributes in the web application. Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()
    A

    String x = (String) pageContext.getAttribute(foo)

    B

    String x = (String) pageContext.getRequestScope(foo)

    C

    It is NOT possible to access the pageContext object from within doStartTag

    D

    String x = (String) pageContext.getRequest().getAttribute(foo)

    E

    String x = (String) pageContext.getAttribute(foo, PageContext.ANY_SCOPE)


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