Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key

image

Play button

image

Play button

image

Progress

1/30

Click to flip

30 Cards in this Set

  • Front
  • Back
Memory for an object’s data is stored as part of the class template.
False
Every object has its own unique identity.
True
A client needs to know only a server’s interface.
True
It is not possible for two variables to refer to the same object.
False
A reference variable can be compared to the null value.
True
Class names must adhere to the rules for naming variables and methods.
True
Instance variables are nearly always declared to be public.
False
If a class template contains no constructors, the JVM provides a primitive default constructor.
True
You cannot call one constructor from another constructor.
False
If the return type of a method is not void, it can be any primitive or reference type.
True
Method names have the same syntax as other Java identifiers.
True
Helper methods are usually public.
False
When an object is instantiated, it gets a complete set of fresh instance variables
True
You cannot have a local variable and a global variable with the same name in a class.
False
You should use local variables to remember information in an object.
False
The combining of data and behavior into a single software package is called ____.
Encapsulation
An object has ____ as defined by the methods of its class.
Behavior
A server’s data requirements and the implementation of its methods are hidden from the client. This approach is referred to as ____.
Information hiding
Messages that change an object’s state are called ____.
Mutators
Suppose a Student class contains a method setName to set the value of a Student object’s instance variable name, plus a method getName to access the value of name. Consider the following code fragment:



Student s1, s2;

s1 = new Student();

s2 = new Student();

s1.setName(“Bill”);

s2.setName(“Eric”);

s2 = s1;

s2.setName(“Bob”);

System.out.println( s1.getName() );



What would be displayed on the console?
Bob
Methods used to initialize a new object are called ____.
Contructors
Class definitions usually begin with the keyword ____, indicating that the class is accessible to all potential clients.
Public
At the root (base) of Java’s class hierarchy is a class called ____.
Object
Constructors are activated when the keyword ____ is used.
new
Which of the following represents the general form of a method?
a. <visibility modifier> <return type> <method name> (<parameter list>){



<implementing code>



}
b. <return type> <visibility modifier> <method name> (<parameter list>){



<implementing code>



}
c. <visibility modifier> <method name> <return type> (<parameter list>){



<implementing code>



}
d. <return type> <method name> (<parameter list>){



<implementing code>



}
(a)
If a method has a return type, its implementing code must have at least one ____ statement that returns a value of that type.
return
____ variables can be declared in a method to provide temporary working storage for data in the method.
Local
The scope of a ____ is all the methods in the defining class.
Global
The ____ of a variable is the period during which it can be used.
Lifetime
The ____ class includes methods for all but two mouse events, mouse motion and mouse dragging.
MouseAdapter