A) be overloaded.
B) initialize variables to their defaults.
C) specify return types or return values.
D) have the same name as the class.
Correct Answer
verified
Multiple Choice
A) An enum declaration is a comma-separated list of enum constants and may optionally include other components of traditional classes, such as constructors, fields and methods.
B) Any attempt to create an object of an enum type with operator new results in a compilation error.
C) An enum constructor cannot be overloaded.
D) enum constants are implicitly final and static.
Correct Answer
verified
Multiple Choice
A) Accessing a private variable.
B) Accessing a public variable.
C) Accessing a local variable.
D) Accessing an instance variable that is shadowed by a local variable.
Correct Answer
verified
Multiple Choice
A) printf.
B) format.
C) formatString.
D) toFormatedString.
Correct Answer
verified
Multiple Choice
A) a method to refer explicitly to the instance variables and other methods of the object on which the method was called.
B) a method to refer implicitly to the instance variables and other methods of the object on which the method was called.
C) an object to reference itself.
D) All of the above.
Correct Answer
verified
Multiple Choice
A) Methods and instance variables can both be either public or private.
B) Information hiding is achieved by restricting access to class members via keyword public.
C) The private members of a class are directly accessible to the clients of a class.
D) None of the above is true.
Correct Answer
verified
Multiple Choice
A) Cause syntax errors if used as a left-hand value.
B) Be initialized.
C) Be modified after they are initialized.
D) None of the above.
Correct Answer
verified
Multiple Choice
A) public constructors.
B) public instance variables.
C) public methods.
D) All of the above.
Correct Answer
verified
Multiple Choice
A) A static method must be used to access private static instance variables.
B) A static method has no this reference.
C) A static method can be accessed even when no objects of its class have been instantiated.
D) A static method can call instance methods directly.
Correct Answer
verified
Multiple Choice
A) The instance variables are public.
B) The instance variables are private.
C) The methods perform validity checking.
D) Both b and c.
Correct Answer
verified
Multiple Choice
A) The actual data representation used within the class is of no concern to the class's clients.
B) Clients generally care about what the class does but not how the class does it.
C) Clients are usually involved in a class's implementation.
D) Hiding the implementation reduces the possibility that clients will become dependent on class-implementation details.
Correct Answer
verified
Multiple Choice
A) values.
B) getValues.
C) constants.
D) getConstants.
Correct Answer
verified
Multiple Choice
A) Initialize instance variables.
B) When overloaded, can have identical argument lists.
C) When overloaded, are selected by number, types and order of types of parameters.
D) Both (a) and (c) .
Correct Answer
verified
Multiple Choice
A) Method finalize does not take parameters and has return type void.
B) Memory leaks using Java are rare because of automatic garbage collection.
C) Objects are marked for garbage collection by method finalize.
D) The garbage collector reclaims unused memory.
Correct Answer
verified
Multiple Choice
A) public.
B) private.
C) protected.
D) All of the above.
Correct Answer
verified
Multiple Choice
A) query, mutator.
B) accessor, mutator.
C) mutator, accessor.
D) query, accessor.
Correct Answer
verified
Multiple Choice
A) A compilation error occurs.
B) A runtime error occurs.
C) A logic error occurs.
D) Nothing happens. The program compiles and runs.
Correct Answer
verified
Multiple Choice
A) Is public.
B) Is private.
C) Has package access.
D) Is static.
Correct Answer
verified
Multiple Choice
A) private.
B) public.
C) protected.
D) static.
Correct Answer
verified
Multiple Choice
A) empty constructor.
B) no-argument constructor.
C) default constructor.
D) null constructor.
Correct Answer
verified
Showing 1 - 20 of 27
Related Exams