Question: (a) Which of the following statements about Java variables are true? I. A variable in Java may contain a primitive value or the value of

(a) Which of the following statements about Java variables are true?

I. A variable in Java may contain a primitive value or the value of an object

II. A variable in Java may contain a primitive value or a reference value to the memory location of an object

III. A static variable may be used to represent the state of an object

IV. The Java garbage collector deletes the value of a variable once its value is no longer in use by the program

(b) Which of these statements about Java classes is false?

A Java program requires at least one Java class to run

B. A Java program requires a class to be instantiated as an object before it can be run.

C. A Java class can have several constructor methods

D. A Java class is a template from which objects can be created

E. A Java class may contain only static methods

(c) Which of the following statements are incorrect?

A. private variables of a class can only be accessed by other members of the class and its sub classes

B. public variables of a class can be accessed by any code in the program

C. protected variables of a class can be accessed by other classes within the same package.

D. protected members of a class can be inherited by a sub class

(d) Explain briefly what is meant by overloading a constructor method

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!