Escolar Documentos
Profissional Documentos
Cultura Documentos
(A) false
(B) void
(C) null
(D) not specified in the method definition
Correct answer is (B)
2.
Which of the following statements about class variables in Java is not true?
(A) Non-static methods in a class can access the class variable defined in the same class.
(B) Class variables do not need the reference to the object of the instantiated class to access them.
(C) Class variables require the modifier static in the declarations.
(D) All objects have their own copy of the class variable defined in the instantiated class.
Correct answer is (D)
3.
What is used to indicate that a method does not return a value? (A) the name of the class to which
it belongs
(B) the keyword static
(C) the keyword void
(D) the omission of the return type
Correct answer is (C)
4.
Consider the following Java program segment.
import java.io. *;
public Test () {
System.out.println ("default");
}
System.out.println ("non-default");
}
9.
From within a child class, its parent class is referred to via the keyword
(A) parent
(B) Base
(C) this
(D) super
Correct answer is (D)
10.
When a subclass defines an instance method with the same return type and signature as
a method in its parent, the parent's method is said to be
(A) private
(B) overridden
(C) overloaded
(D) Hidden
Correct answer is (B)
2.
If a class contains a constructor, that constructor will be invoked
(A) each time an object of that class is instantiated
(B) once at the beginning of any program that uses that class
(C) each time an object of that class goes out of scope
(D) once the first time an object of that class is instantiated
Correct answer is (A)
3.
The term class variable is a synonym for
(A) a read-only variable
(B) a private data field
protected String () {
return "Hi";
}
}
public class Object2 extends Object1 {
protected String () {