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

题目内容 (请给出正确答案)
填空题
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.()” 相关考题
考题 GiventheJSPcode:%request.setAttribute(foo,bar);%andtheClassictaghandlercode:5.publicintdoStartTag()throwsJspException{6.//insertcodehere7.//returnint8.}Assumetherearenootherfooattributesinthewebapplication.WhichinvocationonthepageContextobject,insertedatline6,assignsbartothevariablex?()A.Stringx=(String)pageContext.getAttribute(foo)B.Stringx=(String)pageContext.getRequestScope(foo)C.ItisNOTpossibletoaccessthepageContextobjectfromwithindoStartTagD.Stringx=(String)pageContext.getRequest().getAttribute(foo)E.Stringx=(String)pageContext.getAttribute(foo,PageContext.ANY_SCOPE)

考题 publicclassBase{publicstaticfinalStringFOO=foo”;publicstaticvoidmain(String[]args){Baseb=newBase();Subs=newSub();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);}}classSubextendsBase{publicstaticfinalStringFOO=bar;}Whatistheresult?()A.foofoofoofoofooB.foobarfoobarbarC.foobarfoofoofooD.foobarfoobarfooE.barbarbarbarbarF.foofoofoobarbarG.foofoofoobarfoo

考题 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、 foofoofoofoofooB、 foobarfoobarbarC、 foobarfoofoofooD、 foobarfoobarfooE、 barbarbarbarbarF、 foofoofoobarbarG、 foofoofoobarfoo

考题 int index = 1;   String test = new String;   String foo = test[index];  What is the result?()A、 Foo has the value “”B、 Foo has the value nullC、 An exception is thrownD、 The code will not compile

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

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

考题 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(); }

考题 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 = 3B、 Compilation fails.C、 A ClassCastException is thrown at line 6.D、 A ClassCastException is thrown at line 7.

考题 现有:  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、  0B、  1C、  2D、  3

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

考题 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 doStartTagD、String x = (String) pageContext.getRequest().getAttribute("foo")E、String x = (String) pageContext.getAttribute("foo", PageContext.ANY_SCOPE)

考题 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、 testB、 nullC、 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.

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

考题 多选题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行,可以编译?()Aint doStuff() { return 42; }Bint doStuff(int x) { return 42; }CFoo doStuff(int x) { return new Foo(); }DSuperFoo doStuff(int x) { return new Foo(); }

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

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

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

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

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

考题 单选题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 = 3B  Compilation fails.C  A ClassCastException is thrown at line 6.D  A ClassCastException is thrown at line 7.

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

考题 单选题现有:  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  1B  2C  3D  4

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

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

考题 单选题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  foofoofoofoofooB  foobarfoobarbarC  foobarfoofoofooD  foobarfoobarfooE  barbarbarbarbarF  foofoofoobarbarG  foofoofoobarfoo

考题 填空题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?()

考题 单选题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 doStartTagD String x = (String) pageContext.getRequest().getAttribute(foo)E String x = (String) pageContext.getAttribute(foo, PageContext.ANY_SCOPE)

考题 单选题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 doStartTagD String x = (String) pageContext.getRequest().getAttribute(foo)E String x = (String) pageContext.getAttribute(foo, PageContext.ANY_SCOPE)