What is a constructor in Java?
A. A constructor is a method that is called when an object is created to initialize its state.
B. A constructor is a method that is called when an object is destroyed to clean up its state.
C. A constructor is a method that is called when a class is loaded into memory.
D. None of the above.
Answer:A
What is a constructor in Java?
A. A constructor is a method that is called when an object is created to initialize its state. B. A constructor is a method that is called when an object is destroyed to clean up its state. C. A constructor is a method that is called when a class is loaded into memory. D. None of the above.