In inheritance, when an object is created for subclass, is an object also created for its superclass? I find the answer to the above question is yes, its created.Am I right?
No, it won't create a super class object when you create sub class object. Sub class object will have super class functionalists by inheriting from Super Class. Only one object will be created when you create an sub class object
Is long a primitive type or wrapper class??
long
is an primitive data type, Long
is corresponding Wrapper class.
Question : When last brace is reached, how many objects are eligible for the garbage collection?
Yes, There will be 6 objects, including 3 Long
objects