118k views
1 vote
Which of the following is used to allocate memory for the instance variables of an object of a class?1. the reserved word public

2. the operator new
3. the operator +
4. the reserved word static

User Xbrady
by
8.3k points

1 Answer

5 votes

Answer:

The correct answer to the following question will be 2. the operator new.

Explanation:

New operator is used to allocating the memory to the instance object.The new object can be created by using a "new" keyword in java .

Syntax of using 'new' operator is :

class_name object_name=new class_name() // it allocated the memory to the class

For Example :

ABC obj = new ABC;

Now, this time obj points to the object of the ABC class.

obj = new ABC ();

call the construction of ABC class

User Bradimus
by
8.0k points