4>> Which two statements are reserved words in Java? (Choose Two) A.run B.import C.default D.implement //why not "const"and "goto"???
5>>Given:(ans:c) 1.public class Foo implements Runnable { 2.public void run (Thread t) { 3.system.out.printIn(“Running.”); 4.} 5.public static void main (String[] args) { 6.new thread (new Foo()).start(); 7.) 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 2 causes the compilation to fail. E.“Running” is printed and the program exits
is a是继承关系 has a是引用关系请教上题为什么答案是c,怎么看第一行不会有错啊。
86.Click the exhibit button: 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 //怎么判断错在那行,比如说:有个函数调用在10行,但这个函数写在20行, 到底是第10行错还是第20行错? 再比如说:子类要调用超类的构造函数,但超类没这个函数,是在子类错还是超类错呀?
Which two statements are reserved words in Java? (Choose Two)
A.run
B.import
C.default
D.implement
//why not "const"and "goto"???
1.public class Foo implements Runnable {
2.public void run (Thread t) {
3.system.out.printIn(“Running.”);
4.}
5.public static void main (String[] args) {
6.new thread (new Foo()).start();
7.) 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 2 causes the compilation to fail.
E.“Running” is printed and the program exits
has a是引用关系请教上题为什么答案是c,怎么看第一行不会有错啊。
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 //怎么判断错在那行,比如说:有个函数调用在10行,但这个函数写在20行,
到底是第10行错还是第20行错?
再比如说:子类要调用超类的构造函数,但超类没这个函数,是在子类错还是超类错呀?