Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted independently atline 5,return the value of the attribute?()
第1题:
class One { void foo() {} } class Two extends One { //insert method here } Which three methods, inserted individually at line 14, will correctly complete class Two?()
第2题:
10. interface Foo { int bar(); } 11. public class Sprite { 12. public int fubar( Foo foo) { return foo.bar(); } 13. public void testFoo() { 14. fubar( 15. // insert code here 16.); 17. } 18. } Which code, inserted at line 15, allows the class Sprite to compile?()
第3题:
class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { // insert method here } Which two methods, inserted individually, correctly complete the Three class?()
第4题:
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行,可以编译?()
第5题:
Given: 5.public class MyTagHandler extends TagSupport { 6.public int doStartTag() throws JspException { 7.try { 8.// insert code here 9.} catch(Exception ex) { /* handle exception */ } 10.return super.doStartTag(); 11.}...42. } Which code snippet, inserted at line 8,causes the value foo to be output?()
第6题:
10. interface Foo {} 11. class Alpha implements Foo {} 12. class Beta extends Alpha {} 13. class Delta extends Beta { 14. public static void main( String[] args) { 15. Beta x = new Beta(); 16. // insert code here 17. } 18. } Which code, inserted at line 16, will cause a java.lang.ClassCastException?()
第7题:
1. public class Blip { 2. protected int blipvert(int x) { return 0; } 3. } 4. class Vert extends Blip { 5. // insert code here 6. } Which five methods, inserted independently at line 5, will compile?()
第8题:
public void foo() { /* more code here */ }
private void foo() { /* more code here */ }
protected void foo() { /* more code here */ }
int foo() { /* more code here */ }
void foo() { /* more code here */ }
第9题:
int foo() { /* more code here */ }
void foo() { /* more code here */ }
public void foo() { /* more code here */ }
private void foo() { /* more code here */ }
protected void foo() { /* more code here */ }
第10题:
int gap() { return 7; }
public int gap() { return 7; }
private int gap(int x) { return 7; }
protected Creb gap() { return this; }
public int gap() { return Integer.getInteger (42); }
第11题:
public void foo() { }
public int foo() { return 3; }
public Two foo() { return this; }
public One foo() { return this; }
public Object foo() { return this; }
第12题:
String x = (String) pageContext.getAttribute(foo)
String x = (String) pageContext.getRequestScope(foo)
It is NOT possible to access the pageContext object from within doStartTag
String x = (String) pageContext.getRequest().getAttribute(foo)
String x = (String) pageContext.getAttribute(foo, PageContext.ANY_SCOPE)
第13题:
1.class SuperFo{ 2. SuperFo doStuff(int x){ 3.return new SuperFo() 4.} 5.} 6. 7.class Foo extends SuperFo{ 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行,有几个可以通过编译 ()
第14题:
现有: 1. class Synapse { 2. protected int gap() { return 7; } 3. } 4. 5. class Creb extends Synapse { 6. // insert code here 7. } 分别插入到第 6 行,哪三行可以编译?()
第15题:
public class Score implements Comparable
第16题:
interface A { public int getValue() } class B implements A { public int getValue() { return 1; } } class C extends B { // insert code here } Which three code fragments, inserted individually at line 15, make use of polymorphism?()
第17题:
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?()
第18题:
现有: 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行,有几个可以通过编泽?()
第19题:
Given: 10. class One { 11. void foo() { } 12. } 13. class Two extends One { 14. //insert method here 15. } Which three methods, inserted individually at line 14, will correctly complete class Two?()
第20题:
int doStuff() { return 42; }
int doStuff(int x) { return 42; }
Foo doStuff(int x) { return new Foo(); }
SuperFoo doStuff(int x) { return new Foo(); }
第21题:
int gap() { return 7; }
public int gap() { return 7; }
private int gap(int x) { return 7; }
protected Creb gap() { return this; }
public int gap() { return Integer.getInteger (42); }
第22题:
int foo() { /* more code here */ }
void foo() { /* more code here */ }
public void foo() { /* more code here */ }
private void foo() { /* more code here */ }
protected void foo() { /* more code here */ }
第23题:
String x = (String) pageContext.getAttribute(foo)
String x = (String) pageContext.getRequestScope(foo)
It is NOT possible to access the pageContext object from within doStartTag
String x = (String) pageContext.getRequest().getAttribute(foo)
String x = (String) pageContext.getAttribute(foo, PageContext.ANY_SCOPE)