asked 139k views
2 votes
T or F: The Java keyword new is a method that can be called to create objects.

1 Answer

1 vote

Final answer:

The new keyword in Java is a method that is used to create objects. It allocates memory for an object of a class and initializes its attributes using the class constructor.

Step-by-step explanation:

The statement is true. The new keyword in Java is a method that is used to create objects. When the new keyword is called with a class name, it allocates memory for an object of that class and initializes its attributes using the class constructor.

For example, consider the following code:

MyClass obj = new MyClass();

In this code, the new keyword is used to create a new object of the MyClass class. The obj variable will be assigned a reference to the newly created object.

answered
User G Huxley
by
7.4k points