Question
QUESTION 1 Each class must be declared in its own .java file True or False? QUESTION 2 The keyword this must always be explicitly used
QUESTION 1
-
Each class must be declared in its own .java file
True or False?
QUESTION 2
-
The keyword this must always be explicitly used when referring to an object's instance variables and methods from within one of its non-static methods.
True or False?
QUESTION 3
-
When used in a class' main method the this keyword references the object representing the class itself.
True or False?
QUESTION 4
-
Accessor methods that test whether a condition is true or false are often called predicate methods.
True or False?
QUESTION 5
-
A class that holds references to objects of other classes as members demonstrates composition (a has-a relationship).
True or False?
QUESTION 6
- The following code creates a new instance of the Pixel enum and assigns it to myPixel:
enum Pixel {RED, GREEN, BLUE}
// ...
Pixel myPixel = new Pixel();
True or False?
QUESTION 7
What does the following code display?
enum Pixel {RED, GREEN, BLUE}
// ...
public static void main(String args[]) {
for (Pixel px : Pixel.values()) {
System.out.print(px);
}
}
QUESTION 8
-
A program might be terminated before the JVM's garbage collector has been executed.
True or False?
QUESTION 9
- The following import statement allows the class that contains it to access all static members of the java.lang.Math class by their unqualified names (e.g.: double piVal = PI;)
import static java.lang.Math.*;
True or False?
QUESTION 10
-
Variables with constant values (those that cannot be modified once initialized) are declared with the keyword ______.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started