Java OOP

 

SHORT ANSWER QUESTIONS

BASIC OBJECTS

 

QUESTIONS


Fill the blanks and short answer questions.  Solutions are available.

a)    A ___________ is a blueprint that is used by Java to create objects with specific characteristics and functionality.

b)    The name of a class should start with a _____________ ______________.

c)     Another word for object is ____________.

d)    The name of an object should start with a ___________ _____________ (just like names of variables).

e)    ______________ _______________ (also called ________________), are the variables in which information is stored inside objects.

f)      Each ______________ or _______________ gets its own copy of the instance variables.

g)    Consider the memory diagram of an object below.  What is the name of the instance?

 



h)    In the diagram above, how many instance variables does the class that was used to create the instance coco have?

i)       What will the following code output to screen?

 

           Point p = new Point();

           p.x = 5;

           p.y = 2;

           Point q = p;

           System.out.println(q.x);

 

j)       What will the following code output to screen?

 

           Point p = new Point();

           p.x = 5;

           p.y = 2;

           Point q = p;

           q.x = 3.5;

           System.out.println(p.x);



SOLUTIONS

 

Click here.