ANSWERS 2026/2027
Given a class named Test, which of these would be valid definitions for the constructors
for the class?
Select 1 option
A. Test( Test b) { }
B. Test Test( ) { }
C. private final Test( ) { }
D. void Test( ) { }
E. public static void Test( String args[ ] ) { } - ANSWER-Correct Option is : A
A. Test( Test b) { } The constructor can take the same type as a parameter.
B. Test Test( ) { } A constructor cannot return anything.
C. private final Test( ) { } A constructor cannot be final, static or abstract.
D. void Test( ) { } A constructor cannot return anything not even void.
E. public static void Test( String args[ ] ) { } A constructor cannot be final, static or
abstract.
A class can define multiple components. All the Java components you've heard of can
be defined within a Java class: ________ and ________ statements, variables,
constructors, methods, comments, nested classes, nested interfaces, annotations, and
enums. - ANSWER-package, import
True or False: The OCA Java SE 7 Programmer I exam covers the definitions of nested
classes, nested interfaces, annotations, and enums. - ANSWER-False:The OCA Java
SE 7 Programmer I exam doesn't cover the definitions of nested classes, nested
interfaces, annotations, and enums.
If a class defines a package statement, where should it be in the class definition? -
ANSWER-It should be the frist statement in the class definition
True or False: The package statement can appear within a class declaration or after the
class declaration. - ANSWER-False
How many times can a package statement appear in a class? - ANSWER-Only once, if
at all
True or False: The import statement uses simple names of classes and interfaces from
within the class. - ANSWER-True
True of False: The import statement can’t be used to import multiple classes or
interfaces with the same name. - ANSWER-True
, True or False: A class can have only one import statement. - ANSWER-False: A class
can include multiple import statements.
Where do import statements go in relation to package statements in the class
definition? - ANSWER-The import statements should follow the package statement?
Where can comments appear in a class definition? - ANSWER-They can go anywhere.
True or False: A comment can appear before or after a package statement, before or
after the class definition, and before, within, or after a method definition. - ANSWER-
True
Comments come in what two flavors? - ANSWER-Multiline and end-of-line
What special characters can comments contain? - ANSWER-Any characters including
characters from the Unicode charset
What do multiline comments start and end with? - ANSWER-/* */
What do end-of-line comments start with? - ANSWER-//
True or False: Class declarations and class definitions are components of a Java class.
- ANSWER-True
How many instance variables, methods, and constructors can a class define? -
ANSWER-0 or more.
True or False: The order of the definition of instance variables, constructors, and
methods matters in a class. - ANSWER-False
True or False: A class may define an instance variable before or after the definition of a
method and still use it. - ANSWER-True
What is the extension for a java source file? - ANSWER-.java
True or False: A Java source code file can define multiple classes and interfaces. -
ANSWER-True
A public class can be defined only in a source code file with the same ________. -
ANSWER-name
Package and Import statement apply to which class and interface definitions in a source
code file? - ANSWER-All of them.