When we should make an instance variable private - Java
Explain when should we make an instance variable private.- The variables which are defined within the class are known as instance variables. - Each instance of this class contains its own copy of these variables. - These variables can be declared as public,private or default. - This variable can be declared as private to promote information hiding so that no other object can access them.
|
Why should we catch super class exceptions?Every exception is represented by the instance of Throwable or its subclasses. An object can carry the information for the exception raising point to the exception handler which catches it...