Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. A class in java is like a. b. c. d. a variable an object an instantiation of

ID: 3856611 • Letter: 1

Question

1. A class in java is like a. b. c. d. a variable an object an instantiation of an object a blueprint for creating objects 2. The signature of a method consists of the following a. b. c. d. Return type, method name and types of input parameters Method name and types of input parameters Method name, types of input parameters and their order Return type, method name, types of input parameters and their order 3. The following is true with respect to a static variable a. b. c. d. It can be modified by only one object Each object gets a unique copy of the static variable Only one copy exists - no matter how many objects are instantiated Cannot be modified by non-static method 4. The get and set methods in a class are also known, respectively, as a. b. c. d. accessor and mutator methods mutator and accessor methods accessor and constructor methods mutator and constructor methods. 5. If a class is named Student, what name can you use for a constructor for this class? a. Student b. Student.java c. void Student d. any name can be used since the constructor can be overloaded 6. When defining a constructor, what do you specify for the type of value returned? a. Primitive data type such as int b. Class name such as Student c. void d. Constructor does not have an explicit return type

Explanation / Answer

1. D       

A class in java is like blueprint or template and this will describe the methods and variables of the each object.

2. A

A method signature consists of a Method Name as an identifier, a Parameter List and a Return Type

3. C

In Java static variable, a single copy to be shared by all instances of the class

4. B

A Mutator method used to control changes to a variable and this method also known as Setter methods. A Setter is often accompanied by a Getter and this is also known as an Accessor, this returns the value of the private member variable.

5. A

A Constructor name must be same as the class name.

6. D

A Constructor must have no explicit return type.

7. B

A static method is belongs to the class and not to the object (instance), a static method can access only static data. It cannot access non-static data (instance variables). A static method can call only other static methods and cannot call a non-static method from it. A static method can be accessed directly by the class name and doesn’t need any object syntax: <class-name>.<method-name>.

8. B

The entity reference of class is known as Aggregation and it represents HAS-A relationship.

Time finished…..