Java: Classes and Objects Exam Questions
With Correct Answers.
Objects have two properties. One is state. What is the other? - Answer✔Behavior
The state of an object is stored in _____ _____ - Answer✔Instance variables
The behavior of an object is represented by ______ ______ - Answer✔Instance methods
The job of a _____ is to initialize instance variables at the time an object is created. -
Answer✔Constructor
Nested inside a class declaration are three kinds of declarations. What are they? -
Answer✔Constructor declarations
Variable declarations
Method declarations
The words public and private are _____ _____ - Answer✔Access modifiers
A method is allowed to have _______, which represent data that will be supplied when the
method is called. - Answer✔Parameters
Once a class has been declared, we can create objects that belong to the class. We say that these
objects are ______ of the class. - Answer✔Instances
An object variable doesn't actually store an object. Instead, it stores a ______ to an object. -
Answer✔Reference
The keyword ______ is placed before a class name in order to create an object. - Answer✔new
To perform an operation on an object, we _______ one of the instance methods associated with
the object. - Answer✔Call
How do you call an instance method - Answer✔object.methodname(arguments)
Reference variables are known as _______ variables in other programming languages. -
Answer✔Pointer
1|Page