Frequently Asked Java Interview Questions Part - 4

Part 4

16 : Can we overload static methods? 

Answer : Yes.. There is not any restriction to overload static methods. We can overload static and non static methods in java. VIEW MORE on overloading in java.

17 : Can we use private member of parent class in sub class?

Answer : No.. It will not allow to use private members like private method, variable of parent class in child class. Private members are accessible only inside same class. VIEW MORE about class modifiers.

18 : What is an interface in java?

Answer : An interface is a blue print of a class which can hold abstract methods (Methods without implementation) only. It creates Rules To Follow structure for class where It Is Implemented. We can achieve 100% abstraction using interface in java. READ MORE about interface in java.

19 Can we access protected method of parent class in sub class? 

Answer : Yes.. We can access protected members of parent class in all it's sub classes and classes within the same package. VIEW EXAMPLE on how to access protected method in sub class.

20 : What is an array in java?

Answer : An array is container object in java which can hold fixed number of values of same type. VIEW ARTICLE on array.

No comments:

Post a Comment