public interface Foo{
int k = 4;
}
Which three are equivalent to line 2? ()
A. Final int k = 4;
B. Public int k = 4;
C. Static int k = 4;
D. Private int k = 4;
E. Abstract int k = 4;
F. Volatile int k = 4;
G. Transient int k = 4;
H. Protected int k = 4;
您可能感兴趣的试卷
你可能感兴趣的试题
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 null
C. An exception is thrown
D. The code will not compile
public class Test {
public static void main (Stringargs) {
String foo = args[1];
String bar = args;
String baz = args;
System.out.printIn(“baz = ” + baz);
}
}
And the output: Baz = 2
Which command line invocation will produce the output?()
A. Java Test 2222
B. Java Test 1 2 3 4
C. Java Test 4 2 4 2
D. Java Test 4 3 2 1
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.
A. false
B. default
C. _object
D. a-class
A. New BufferedInputStream(“in.txt”);
B. New BufferedInputStream(new File(“in.txt”));
C. New BufferedInputStream(Writer(“in.txt”));
D. New BufferedInputStream(new Writer(“in.txt”));
E. New BufferedInputStream(new InputStream(“in.txt”));
F. New BufferedInputStream(new FileInputStream(“in.txt”));
A. OutputStream out=new FileOutputStream(“file.txt”);
B. OutputStream out=new FileOutputStream(“file.txt”, “append”);
C. FileOutputStream out=new FileOutputStream(“file.txt”, true);
D. FileOutputStream out=new FileOutputStream(new file(“file.txt”));
E. OutputStream out=new FileOutputStream(new File(“file.txt”)true);
A. InputStream in=new FileReader(“file.txt”);
B. InputStream in=new FileInputStream(“file.txt”);
C. InputStream in=new InputStreamFileReader (“file.txt”, “read”);
D. FileInputStream in=new FileReader(new File(“file.txt”));
E. FileInputStream in=new FileInputStream(new File(“file.txt”));
A. Boolean exists=Directory.exists (“prefs”);
B. Boolean exists=(new File(“prefs”)).isDir();
C. Boolean exists=(new Directory(“prefs”)).exists();
D. Boolean exists=(new File(“prefs”)).isDirectory();
E. Boolean exists=true; Try{ Directory d = new Directory(“prefs”); } catch (FileNotFoundException e) { exists = false; }
class super {
public int getLength() {return 4;}
}
public class Sub extends Super {
public long getLength() {return 5;}
public static void main (Stringargs) {
super sooper = new Super ();
Sub sub = new Sub();
System.out.printIn(
sooper.getLength()+ “,” + sub.getLength() };
}
What is the output?()
A. 4, 4
B. 4, 5
C. 5, 4
D. 5, 5
E. The code will not compile.
A. The default constructor initializes method variables.
B. The compiler always creates a default constructor for every class.
C. The default constructor invokes the no-parameter constructor of the superclass.
D. The default constructor initializes the instance variables declared in the class.
E. When a class has only constructors with parameters, the compiler does not create a default constructor.
最新试题
What is the result?()
Given that t1 is a reference to a live thread, which is true?()
Which statement is true?()
What is the result?()
What is the result?()
Which two are possible results?()
Given that Triangle implements Runnable, and:Which two statements, inserted independently at both lines 35 and 41, tend to allow both threads to temporarily pause and allow the other thread to execute?()
A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?()
Which statement is true?()
What is the result?()