单项选择题Which constructs a DataOutputStream?()  

A. New dataInputStream(“in.txt”);
B. New dataInputStream(new file(“in.txt”));
C. New dataInputStream(new writer(“in.txt”));
D. New dataInputStream(new FileWriter(“in.txt”));
E. New dataInputStream(new InputStream(“in.txt”));
F. New dataInputStream(new FileInputStream(“in.txt”));


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

public class Foo implements Runnable ( 
public void run (Thread t) {  
system.out.printIn(“Running.”);  
}  
public static void main (String args) {  
new thread (new Foo()).start();  
}  
)  
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 6 causes the compilation to fail.
E. “Running” is printed and the program exits.

2.多项选择题Which two can directly cause a thread to stop executing?() 

A. Exiting from a synchronized block.
B. Calling the wait method on an object.
C. Calling the notify method on an object.
D. Calling the notifyAll method on an object.
E. Calling the setPriority method on a thread object.

3.单项选择题

public class ForBar {  
public static void main(String args) {  
int i = 0, j = 5;  
tp: for (;;) {  
i ++;  
for(;;)  
if(i > --j) break tp;  
}  
system.out.printIn(“i = ” + i + “, j = “+ j);  
}  
}  
What is the result? () 

A. The program runs and prints “i=1, j=0”
B. The program runs and prints “i=1, j=4”
C. The program runs and prints “i=3, j=4”
D. The program runs and prints “i=3, j=0”
E. An error at line 4 causes compilation to fail.
F. An error at line 7 causes compilation to fail.

4.多项选择题Which four types of objects can be thrown using the throw statement?()

A. Error
B. Event
C. Object
D. Exception
E. Throwable
F. RuntimeException

7.多项选择题Which two create an instance of an array?() 

A. int ia = new int [15];
B. float fa = new float [20];
C. char ca = “Some String”;
D. Object oa = new float[20];
E. Int ia = (4, 5, 6) (1, 2, 3)

8.单项选择题

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.printIn(foo. i); 
}  
}  
What is the result?()  

A. Compilation will fail.
B. Compilation will succeed and the program will print “3”
C. Compilation will succeed but the program will throw a ClassCastException at line 6.
D. Compilation will succeed but the program will throw a ClassCastException at line 7.

9.多项选择题Which two declarations prevent the overriding of a method? ()

A. Final void methoda(){}
B. Void final methoda(){}
C. Static void methoda(){}
D. Static final void methoda(){}
E. Final abstract void methoda(){}

10.多项选择题

public class OuterClass {  
private double d1 1.0;  
//insert code here  
}  
You need to insert an inner class declaration at line2. Which two inner class declarations are valid?()

A. static class InnerOne {  public double methoda() {return d1;}  }
B. static class InnerOne {  static double methoda() {return d1;}  }
C. private class InnerOne {  public double methoda() {return d1;}  }
D. protected class InnerOne {  static double methoda() {return d1;}  }
E. public abstract class InnerOne {  public abstract double methoda();  }