Docsity

Java: Classes and Objects - Questions and Answers, Exams of Computer Science

Toggle sidebar
bg1
JAVA; CLASSES AND OBJECTS
QUESTIONS AND 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 behaviour of an object is represented by ______ ______ - ANSWER
Instance methods
The job of a _____ is to initialise instance variables at the time an object is
created. - ANSWER Constructor
There are three kinds of declarations nested inside a class declaration. 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
pf3

Partial preview of the text

Download Java: Classes and Objects - Questions and Answers and more Exams Computer Science in PDF only on Docsity!

JAVA; CLASSES AND OBJECTS

QUESTIONS AND 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 behaviour of an object is represented by ______ ______ - ANSWER Instance methods The job of a _____ is to initialise instance variables at the time an object is created. - ANSWER Constructor There are three kinds of declarations nested inside a class declaration. 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 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 operate 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 referred to as _______ variables in other programming languages. - ANSWER Pointer What value can we assign to an object variable to indicate that it doesn't currently store an object? - ANSWER null A new object that's been created by copying an existing object is said to be a _______. - ANSWER Clone An object that's no longer accessible through any object variable is said to be _______. - ANSWER Garbage