网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector () { i = 4; } public static void main (String args ) { MyVector v = new MyNewVector(); } } The file MyNewVector.java is shown in the exhibit. What is the result?()
A
Compilation will succeed.
B
Compilation will fail at line 5.
C
Compilation will fail at line 6.
D
Compilation will fail at line 14.
E
Compilation will fail at line 17.
参考答案
参考解析
解析:
暂无解析
更多 “单选题package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector () { i = 4; } public static void main (String args ) { MyVector v = new MyNewVector(); } } The file MyNewVector.java is shown in the exhibit. What is the result?()A Compilation will succeed.B Compilation will fail at line 5.C Compilation will fail at line 6.D Compilation will fail at line 14.E Compilation will fail at line 17.” 相关考题
考题
能将程序补充完整的选项是( )。class Person{ private int a; public int change(int m){ return m; }}public class Teacher extends Person{ public int b; public static void main(String arg[]) { Person p = new Person(); Teacher t = new Teacher(); int i; ______ }} B.A.i=mB.i=bC. i=p.aD.i=p. change(50)
考题
能将程序补充完整的选项是______。 class Person{ private int a; phblic int change(int m){return m;} } public class Teacher extends Person{ public int b; public static void main(String arg[ ]){ Person p=new Person( ); Teacher t=new Teacher( ); int i; ______; } }A.i=mB.i=bC.i=p.aD.i=p.change(50)
考题
在下列程序的划线处应填入的语句是class Person { private int a;}public class Man extends Person{ public int b; public static void main (String arg []){ Person p=new Person(); Man t=new Man(); int i: }}A.i=w;B.i=bC.i=p.a;D.i=t.b;
考题
下面程序段的输出结果是 class Base { int i; Base() { add(1); } void add(int v) { i+=v; } void print() { System.out.println(i); } } class Extension extends Base { Extension() { add(2); } void add(int v) { i+=v*2; } } public class Test { public static void main(String args[]) { bogo(new Extension()); } static void bogo(Baseb){ b.add(8); b.print(); } }A.9B.18C.20D.22
考题
在下列程序的划线处应填入的语句是 class Pemon { pnvate int a; } public class Man extends Person { public int b; public static void main(String arg[ ] ) { Person p = new Person( ); Man t = new Man( ); int i; ________ } }A.i = w;B.i = b;C.i = p.a;D.i = t.b;
考题
以下程序调试结果为:class Base{Base(){int i = 100;System.out.print (i);}}public class Pri extends Base{static int i = 200;public static void main(String argv[]){Pri p = new Pri();System.out.print(i);}}
A.编译错误B.200C.100200D.100
考题
( 30 )在程序的下划线处应填入的选项是public class Test _________{public static void main(String args[]){Test t = new Test();Thread tt = new Thread(t);tt.start();}public void run(){for(int i=0;i5;i++){system.out.println( " i= " +i);}}}A ) implements RunnableB ) extends ThreadC ) implements ThreadD ) extends Runnable
考题
Which are syntactically valid statement at// point x?() class Person { private int a; public int change(int m){ return m; } } public class Teacher extends Person { public int b; public static void main(String arg[]){ Person p = new Person(); Teacher t = new Teacher(); int i; // point x } } A、 i = m;B、 i = b;C、 i = p.a;D、 i = p.change(30);E、 i = t.b.
考题
class Super { public int i = 0; public Super(String text) { i = 1; } } public class Sub extends Super { public Sub(String text) { i = 2; } public static void main(String args[]) { Sub sub = new Sub(“Hello”); System.out.println(sub.i); } } What is the result?() A、 0B、 1C、 2D、 Compilation fails.
考题
对于下列代码: 1) class Person { 2} public void printValue(int i, int j) {//... } 3} public void printValue(int i){//... } 4} } 5) public class Teacher extends Person { 6} public void printValue( ) {//... } 7} public void printValue(int i) {//...} 8} public static void main(String args[]){ 9} Person t = new Teacher( ); 10} t.printValue(10); 11} } 第10行语句将调用哪行语句?()A、 line 2B、 line 3C、 line 6D、 line 7
考题
1. package foo; 2. 3. import java.util.Vector; 4. 5. private class MyVector extends Vector { 6. int i = 1; 7. public MyVector() { 8. i = 2; 9. } 10. } 11. 12. public class MyNewVector extends MyVector { 13. public MyNewVector () { 14. i = 4; 15. } 16. public static void main (String args []) { 17. MyVector v = new MyNewVector(); 18. } 19. } The file MyNewVector.java is shown in the exhibit. What is the result?() A、 Compilation will succeed.B、 Compilation will fail at line 5.C、 Compilation will fail at line 6.D、 Compilation will fail at line 14.E、 Compilation will fail at line 17.
考题
public class Foo { public static void main (String []args) { int i = 1; int j = i++; if ((i++j) (i++ ==j)) { i +=j; } } } What is the final value of i?() A、 1B、 2C、 3D、 4E、 5
考题
package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector() { i = 4; } public static void main(String args[]) { MyVector v = new MyNewVector(); } } What is the result?()A、 Compilation succeeds.B、 Compilation fails because of an error at line 5.C、 Compilation fails because of an error at line 6.D、 Compilation fails because of an error at line 14.E、 Compilation fails because of an error at line 17.
考题
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) class Person { 2) public void printValue(int i, int j) {/*…*/ } 3) public void printValue(int i){/*...*/ } 4) } 5) public class Teacher extends Person { 6) public void printValue() {/*...*/ } 7) public void printValue(int i) {/*...*/} 8) public static void main(String args[]){ 9) Person t = new Teacher(); 10) t.printValue(10); 11) } 12) } Which method will the statement on line 10 call? () A、 on line 2B、 on line 3C、 on line 6D、 on line 7
考题
package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector () { i = 4; } public static void main (String args ) { MyVector v = new MyNewVector(); } } The file MyNewVector.java is shown in the exhibit. What is the result?()A、 Compilation will succeed.B、 Compilation will fail at line 5.C、 Compilation will fail at line 6.D、 Compilation will fail at line 14.E、 Compilation will fail at line 17.
考题
1. package foo; 2. 3. import java.util.Vector; 4. 5. protected class MyVector Vector { 6. init i = 1; 7. public MyVector() { 8. i = 2; 9. } 10. } 11. 12. public class MyNewVector extends MyVector { 13. public MyNewVector() { 14. i = 4; 15. } 16. public static void main(String args[]) { 17. MyVector v = new MyNewVector(); 18. } 19. } What is the result?() A、 Compilation succeeds.B、 Compilation fails because of an error at line 5.C、 Compilation fails because of an error at line 6.D、 Compilation fails because of an error at line 14.E、 Compilation fails because of an error at line 17.
考题
class super ( public int I = 0; public super (string text) ( I = 1 ) ) public class sub extends super ( public sub (string text) ( i= 2 ) public static void main (straing args) ( sub sub = new sub (“Hello”); system.out. PrintIn(sub.i); ) ) What is the result?()A、 Compilation will fail.B、 Compilation will succeed and the program will print “0”C、 Compilation will succeed and the program will print “1”D、 Compilation will succeed and the program will print “2”
考题
单选题1) class Person { 2) public void printValue(int i, int j) {/*…*/ } 3) public void printValue(int i){/*...*/ } 4) } 5) public class Teacher extends Person { 6) public void printValue() {/*...*/ } 7) public void printValue(int i) {/*...*/} 8) public static void main(String args[]){ 9) Person t = new Teacher(); 10) t.printValue(10); 11) } 12) } Which method will the statement on line 10 call? ()A
on line 2B
on line 3C
on line 6D
on line 7
考题
单选题class super ( public int I = 0; public super (string text) ( I = 1 ) ) public class sub extends super ( public sub (string text) ( i= 2 ) public static void main (straing args[]) ( sub sub = new sub (“Hello”); system.out. PrintIn(sub.i); ) ) What is the result?()A
Compilation will fail.B
Compilation will succeed and the program will print “0”C
Compilation will succeed and the program will print “1”D
Compilation will succeed and the program will print “2”
考题
单选题class Super { public int i = 0; public Super(String text) { i = 1; } } public class Sub extends Super { public Sub(String text) { i = 2; } public static void main(String args[]) { Sub sub = new Sub(“Hello”); System.out.println(sub.i); } } What is the result?()A
0B
1C
2D
Compilation fails.
考题
单选题package foo; import java.util.Vector; private class MyVector extends Vector { int i = 1; public MyVector() { i = 2; } } public class MyNewVector extends MyVector { public MyNewVector() { i = 4; } public static void main(String args[]) { MyVector v = new MyNewVector(); } } What is the result?()A
Compilation succeeds.B
Compilation fails because of an error at line 5.C
Compilation fails because of an error at line 6.D
Compilation fails because of an error at line 14.E
Compilation fails because of an error at line 17.
考题
单选题public class Foo { public static void main (String []args) { int i = 1; int j = i++; if ((i++j) (i++ ==j)) { i +=j; } } } What is the final value of i?()A
1B
2C
3D
4E
5
考题
单选题对于下列代码: 1) class Person { 2} public void printValue(int i, int j) {//... } 3} public void printValue(int i){//... } 4} } 5) public class Teacher extends Person { 6} public void printValue( ) {//... } 7} public void printValue(int i) {//...} 8} public static void main(String args[]){ 9} Person t = new Teacher( ); 10} t.printValue(10); 11} } 第10行语句将调用哪行语句?()A
line 2B
line 3C
line 6D
line 7
考题
单选题1. package foo; 2. 3. import java.util.Vector; 4. 5. private class MyVector extends Vector { 6. int i = 1; 7. public MyVector() { 8. i = 2; 9. } 10. } 11. 12. public class MyNewVector extends MyVector { 13. public MyNewVector () { 14. i = 4; 15. } 16. public static void main (String args []) { 17. MyVector v = new MyNewVector(); 18. } 19. } The file MyNewVector.java is shown in the exhibit. What is the result?()A
Compilation will succeed.B
Compilation will fail at line 5.C
Compilation will fail at line 6.D
Compilation will fail at line 14.E
Compilation will fail at line 17.
考题
单选题1. public class Target { 2. private int i = 0; 3. public int addOne() { 4. return ++i; 5. } 6. } And: 1. public class Client { 2. public static void main(String[] args) { 3. System.out.println(new Target().addOne()); 4. } 5. } Which change can you make to Target without affecting Client?()A
Line 4 of class Target can be changed to return i++;B
Line 2 of class Target can be changed to private int i = 1;C
Line 3 of class Target can be changed to private int addOne() {D
Line 2 of class Target can be changed to private Integer i = 0;
考题
单选题1. package foo; 2. 3. import java.util.Vector; 4. 5. protected class MyVector Vector { 6. init i = 1; 7. public MyVector() { 8. i = 2; 9. } 10. } 11. 12. public class MyNewVector extends MyVector { 13. public MyNewVector() { 14. i = 4; 15. } 16. public static void main(String args[]) { 17. MyVector v = new MyNewVector(); 18. } 19. } What is the result?()A
Compilation succeeds.B
Compilation fails because of an error at line 5.C
Compilation fails because of an error at line 6.D
Compilation fails because of an error at line 14.E
Compilation fails because of an error at line 17.
热门标签
最新试卷