44. FilterOutputStream is the parent class for BufferedOutputStream, DataOutputStream and PrintStream. Which classes are valid argument for the constructor of a FilterOutputStream?
A. InputStream
B. OutputStream
C. File
D. RandomAccessFile
E. StreamTokenizer
45. Given a TextArea using a proportional pitch font and constructed like this:
TextArea t=new TextArea(“12345”,5,5);
Which statement is true?
A. The displayed width shows exactly five characters one each line unless otherwise constrained
B. The displayed height is five lines unless otherwise constrained
C. The maximum number of characters in a line will be five
D. The user will be able to edit the character string
E. The displayed string can use multiple fonts
46. Given a List using a proportional pitch font and constructed like this:
List l=new List(5,true);
Which statement is true?
A. The displayed item exactly five lines unless otherwise constrained
B. The displayed item is five lines init, but can displayed more than five Item by scroll
C. The maximum number of item in a list will be five.
D. The list is multiple mode
47. Given this skeleton of a class currently under construction:
public class Example{
int x,y,z;
public Example (int a, int b) {
//lots of complex computation
x=a; y=b;
}
public Example(int a, int b, int c){
// do everything the same as single argument
// version of constructor
// including assignment x=a, y=b, z=c
z=c;
}
}
What is the most concise way to code the “do everything…” part of the constructor taking two arguments?
Short answer:
48. Which correctly create a two dimensional array of integers?
A. int a[][] = new int[][];
B. int a[10][10] = new int[][];
C. int a[][] = new int[10][10];
D. int [][]a = new int[10][10];
E. int []a[] = new int[10][10];
49. Which are correct class declarations? Assume in each case that the text constitutes the entire contents of a file called Fred.java?
A. public class Fred{
public int x = 0;
public Fred (int x){
this.x=x;
}
}
B. public class fred{
public int x = 0;
public Fred (int x){
this.x=x;
}
}
C. public class Fred extends MyBaseClass, MyOtherBaseClass{
public int x = 0;
public Fred(int xval){
x=xval;
}
}
D. protected class Fred{
private int x = 0;
private Fred (int xval){
x=xval;
}
}
E. import java.awt.*;
public class Fred extends Object{
int x;
private Fred(int xval){
x = xval;
}
}
50. A class design requires that a particular member variable must be accessible for direct access by any subclasses of this class. but otherwise not by classes which are not members of the same package. What should be done to achieve this?
A. The variable should be marked public
B. The variable should be marked private
C. The variable should be marked protected
D. The variable should have no special access modifier
E. The variable should be marked private and an accessor method provided
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页
责任编辑:小草