网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
现有: 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
参考答案
更多 “ 现有: 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” 相关考题
考题
Given:Which three methods, inserted individually at line 14, will correctly complete class Two?()
A.int foo() { /* more code here */ }B.void foo() { /* more code here */ }C.public void foo() { /* more code here */ }D.private void foo() { /* more code here */ }E.protected void foo() { /* more code here */ }
考题
Given:Which code, inserted at line 15, allows the class Sprite to compile?()
A.Foo { public int bar() { return 1; }B.new Foo { public int bar() { return 1; }C.new Foo() { public int bar() { return 1; }D.new class Foo { public int bar() { return 1; }
考题
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?()A、Object o = pageContext.getAttribute("foo");B、Object o = pageContext.findAttribute("foo");C、Object o = pageContext.getAttribute("foo",PageContext.SESSION_SCOPE);D、HttpSession s = pageContext.getSession();Object o = s.getAttribute("foo");
考题
class One { void foo() {} } class Two extends One { //insert method here } Which three methods, inserted individually at line 14, will correctly complete class Two?()A、 int foo() { /* more code here */ }B、 void foo() { /* more code here */ }C、 public void foo() { /* more code here */ }D、 private void foo() { /* more code here */ }E、 protected void foo() { /* more code here */ }
考题
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行,有几个可以通过编译 ()A、1B、2C、3D、4E、5
考题
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?() A、 Foo { public int bar() { return 1; } }B、 new Foo { public int bar() { return 1; } }C、 newFoo() { public int bar(){return 1; } }D、 new class Foo { public int bar() { return 1; } }
考题
class Foo { private int x; publicFoo(intx) {this.x=x; } public void setX( int x) { this.x = x; } public int getX() { return x; } } public class Gamma { static Foo fooBar( Foo foo) { foo = new Foo( 100); return foo; } public static void main( String[] args) { Foo foo = new Foo( 300); System.out.print( foo.getX() + “-“); Foo fooFoo = fooBar( foo); System.out.print( foo.getX() + “-“); System.out.print( fooFoo.getX() + “-“); foo = fooBar( fooFoo); System.out.print( foo.getX() + “-“); System.out.prmt( fooFoo.getX()); } } What is the output of this program?()A、 300-100-100-100-100B、 300-300-100-100-100C、 300-300-300-100-100D、 300-300-300-300-100
考题
现有: 1.class Over { 2.int dolt (long x) { return 3; } 3. } 4. 5. class Under extends Over { 6.//insert code here 7. } 和四个方法: short dolt (int y) { return 4; } int dolt(long Xr long y) { return 4; } private int dolt(short y) { return 4; } protected int dolt (long x) { return 4; } 分别插入到第6行,有几个可以通过编译?() A、 1B、 2C、 3D、 4
考题
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?()A、 public void foo() { }B、 public int foo() { return 3; }C、 public Two foo() { return this; }D、 public One foo() { return this; }E、 public Object foo() { return this; }
考题
Which statements concerning the relationships between the following classes are true?() class Foo { int num; Baz comp = new Baz(); } class Bar { boolean flag; } class Baz extends Foo { Bar thing = new Bar(); double limit; } A、A Bar is a Baz.B、A Foo has a Bar.C、A Baz is a Foo.D、A Foo is a Baz.E、A Baz has a Bar.
考题
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(); }
考题
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?()A、JspWriter w = pageContext.getOut();B、print("foo");C、JspWriter w = pageContext.getWriter();D、JspWriter w = new JspWriter(pageContext.getWriter()); . w.print("foo");
考题
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. import java.io.*; 2. public class Foo implements Serializable { 3. public int x, y; 4. public Foo( int x, int y) { this.x = x; this.y = y; } 5. 6. private void writeObject( ObjectOutputStream s) 7. throws IOException { 8. s.writeInt(x); s.writeInt(y) 9. } 10. 11. private void readObject( ObjectInputStream s) 12. throws IOException, ClassNotFoundException { 13. 14. // insert code here 15. 16. } 17. } Which code, inserted at line 14, will allow this class to correctly serialize and deserialize?() A、 s.defaultReadObject();B、 this = s.defaultReadObject();C、 y = s.readInt(); x = s.readInt();D、 x = s.readInt(); y = s.readInt();
考题
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?() A、 Alpha a = x;B、 Foo f= (Delta)x;C、 Foo f= (Alpha)x;D、 Beta b = (Beta)(Alpha)x;
考题
public class Foo { public int a; public Foo() { a = 3; } public void addFive() { a += 5; } } and: public class Bar extends Foo { public int a; public Bar() { a = 8; } public void addFive() { this.a +=5; } } invoked with: Foo foo = new Bar(); foo.addFive(); System.out.println(”Value: “+ foo.a); What is the result?() A、 Value: 3B、 Value: 8C、 Value: 13D、 Compilation fails.E、 The code runs with no output.F、 An exception is thrown at runtime.
考题
public class TestFive { private int x; public void foo() { int current = x; x = current + 1; } public void go() { for(int i=0;i5;i++) { new Thread() { public void run() { foo(); System.out.print(x + “, “); } }.start(); }}} Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()A、 Move the line 12 print statement into the foo() method.B、 Change line 7 to public synchronized void go() {.C、 Change the variable declaration on line 3 to private volatile int x;.D、 Wrap the code inside the foo() method with a synchronized( this ) block.E、 Wrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }.
考题
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?()A、 public void foo() { /* more code here */ }B、 private void foo() { /* more code here */ }C、 protected void foo() { /* more code here */ }D、 int foo() { /* more code here */ } E、 void foo() { /* more code here */ }
考题
多选题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?()Apublic void foo() { /* more code here */ }Bprivate void foo() { /* more code here */ }Cprotected void foo() { /* more code here */ }Dint foo() { /* more code here */ }Evoid foo() { /* more code here */ }
考题
多选题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(); }
考题
单选题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?()A
Alpha a = x;B
Foo f= (Delta)x;C
Foo f= (Alpha)x;D
Beta b = (Beta)(Alpha)x;
考题
单选题public class Foo { public int a; public Foo() { a = 3; } public void addFive() { a += 5; } } and: public class Bar extends Foo { public int a; public Bar() { a = 8; } public void addFive() { this.a +=5; } } invoked with: Foo foo = new Bar(); foo.addFive(); System.out.println(”Value: “+ foo.a); What is the result?()A
Value: 3B
Value: 8C
Value: 13D
Compilation fails.E
The code runs with no output.F
An exception is thrown at runtime.
考题
多选题class One { void foo() {} } class Two extends One { //insert method here } Which three methods, inserted individually at line 14, will correctly complete class Two?()Aint foo() { /* more code here */ }Bvoid foo() { /* more code here */ }Cpublic void foo() { /* more code here */ }Dprivate void foo() { /* more code here */ }Eprotected void foo() { /* more code here */ }
考题
多选题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?()Apublic void foo() { }Bpublic int foo() { return 3; }Cpublic Two foo() { return this; }Dpublic One foo() { return this; }Epublic Object foo() { return this; }
考题
多选题Which statements concerning the relationships between the following classes are true?() class Foo { int num; Baz comp = new Baz(); } class Bar { boolean flag; } class Baz extends Foo { Bar thing = new Bar(); double limit; }AA Bar is a Baz.BA Foo has a Bar.CA Baz is a Foo.DA Foo is a Baz.EA Baz has a Bar.
考题
单选题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)
热门标签
最新试卷