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.
public class ArrayTest {
public static void main (Stringargs) {
float f1, f2;
f1 = new float [10];
f2 = f1;
System.out.printIn (“f2[0]=” + f2[0]);
}
}
What is the result?()
A. It prints f2[0] = 0.0
B. It prints f2[0] = NaN
C. An error at line 5 causes compile to fail.
D. An error at line 6 causes compile to fail.
E. An error at line 6 causes an exception at runtime.
ClassOne.java
package com.abc.pkg1;
public class ClassOne {
private char var = ‘a‘;
char getVar() {return var;}
}
ClassTest.java
package com.abc.pkg2;
import com.abc.pkg1.ClassOne;
public class ClassTest extends ClassOne {
public static void main(Stringargs) {
char a = new ClassOne().getVar();
char b = new ClassTest().getVar();
}
}
What is the result?()
A. Compilation will fail.
B. Compilation succeeds and no exceptions are thrown.
C. Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.
D. Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.
A. Public
B. Private
C. Protected
D. Transient
E. No access modifier is required
public class Mycircle {
public double radius;
public double diameter;
public void setRadius(double radius)
this.radius = radius;
this.diameter= radius * 2;
}
public double getRadius() {
return radius;
}
Which statement is true?()
A. The Mycircle class is fully encapsulated.
B. The diameter of a given MyCircle is guaranteed to be twice its radius.
C. Lines 6 and 7 should be in a synchronized block to ensure encapsulation.
D. The radius of a MyCircle object can be set without affecting its diameter.
最新试题
Which statement is true?()
Which statement is true?()
What is the result?()
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?()
Which statement is true?()
What is the result?()
Which two statements are true?()
What is the result?()
What can be a result?()
Which three changes should be made to adapt this class to be used safely by multiple threads?()