Question 2
Back to Exercise
What does new Car() do?
- A Declares a variable
- B Creates a Car object on the heap and returns a reference to it Correct
- C Copies an existing Car
- D Imports the Car class
Correct Answer: Option B
It also initialises the fields and runs a constructor.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!