Java | Class and Object | Question 1
Predict the output of following Java program?
(B) garbage value
(C) compiler error
(D) runtime error
Explanation: t is just a reference, the object referred by t is not allocated any memory. Unlike C++, in Java all non-primitive objects must be explicitly allocated and these objects are allocated on heap. The following is corrected program.
My Personal Notes arrow_drop_up
Please Login to comment...