garbage collection responsible for memory management
developer don’t need to explicitly allocate memory and dealocate space.
the memory space of objects that don’t refered by any varaible will be auto reclaim
eliminating memory leaks
What is the difference between final, finally & finalize?
final is used to apply restrictions on class/method/variable. Final class can’t be inherited, final method can’t be overridden and final variable value can’t be changed.
finally in [try block], [close resources] code in the finally will be executed whether exception is handled or not.
finalize is used to perform clean up processing just before object is garbage collected. publicvoidfinalize(){}
What’s this and super?
super is used to access methods of the base class while this is used to access methods of the current class.
super(), it refers to constructor of the base class
this(), it refers to the constructor of the current class
What’s a java package?
A package is a collection of related classes and interfaces providing access privileges and namespace management.
namespace management
diff class same purpose
Explain the difference between the “equals ()” method and the “equals-equals (==) operator?
When would you use an Interface instead of an abstract class?