Core Java Interview Question and Answer (For Fresher & Experience )
1. What is the difference between private, protected, and public? These keywords are for allowing privileges to components such as java methods and variables. Public: accessible to all classes Private: accessible only to the class to which they belong Protected: accessible to the class to which they belong and any subclasses. Access specifiers are keywords that determines the type of access to the member of a class. These are: * Public * Protected * Private * Defaults 2. What's the difference between an interface and an abstract class? Also discuss the similarities. (Very Important) Abstract class is a class which contain one or more abstract methods, which has to be implemented by sub classes. Interface is a Java Object containing method declaration and doesn't contain implementation. The classes which have implementing the Interfaces must provide the method definition for all the methods Abstract class is a Class prefix with a abstract keyword followed by Class definition. ...