Here are top selected core java interview questions asked in high level interviews, these questions may be helpful for both freshers or experienced professional going for interview.
11) What is Polymorphism in Java ? Polymorphism means many forms, in java it is possible to have many forms of a single method on the basis of difference in between their parameters. In java polymorphism can be seen in the form of Overloading or Overriding.
12) What is Inheritance in Java ? When an object acquires the properties(variables) or behavior(methods) of another object, it is called inheritance. In java inheritance is obtained using extending a class or implementing an interface, it helps in reusing the code and eliminate core delicacy.
13) What is encapsulation in Java? Encapsulation means to provide a protective wrapper over code called class, so that the code outside the wrapper cannot access the internal code directly. In java encapsulation is obtained using access specifies like private, protected etc.
14) What is method overloading in java? In java, method overloading refers to having two or more methods with same name and in difference of either of the following. 1) Either the number of arguments are different of two or more methods of same name. 2) Or data types of the arguments are different of two or more methods of same name. 3) Or both (1) and (2). Two or more methods are not overloaded if those are different in only their return types or placement of their parameters.
15) What is method overriding in Java?When a subclass have a method with same name and same arguments as in it?s superclass, this is called method overriding. The benefits of overriding is to have subclass specific behavior of a method defined in their superclass.
16) How to prevent a method from being overridden In Java? In java a method can be prevented from being overridden in subclass by using final keyword, it means that this method declaration is final now and can not be overridden in any of the subclass.
17) What is multiple inheritance? Does java support multiple inheritance? When a class or object extends more than one class or object, this is called multiple inheritance. Java does not support multiple inheritance.
18) What are local variables in Java ?In java all variables which are declared inside a block or a method are called local variables. Local variables must be initialized before using them.