Java interview questions and answers Set 2
11.What is method overloading?
Method overloading is process in which coder can define two or more methods with same name but different arguments .for example
1 . getInput( int a)
2. getInput( String a)
12.What is Recursion?
Recursion is process of defining something in terms of itself.In terms of programming in recursion function or method call itself again and again to obtain the required result.
13.What is inheritance?
Inheritance is nothing but reusing the existing code.in process of inheritance one class extends the other class means one class uses the code of other class.for example there are 2 classes animal and dog both class contain the some same properties therfore instead of writing same code again and again its better to create new class which will extend animal class and has its own properties also.
14.Method overriding ?
When method in subclass has same name as method in super class then method in subclass said to be override.
15.abstract method ?
Method which is only declared not defined is called as abstract method.In simple words The method which does not contain any code inside its body is abstract method.
//does not contain anything
The class which contain abstract method is called as abstract method .We cannot create the object of the abstract class.
Interface is the collection of the abstract method.one class cannot inherits the two or more class ,to achieve this interfaces are used.
18.Local variable :
The variable which are declared in methods, constructors, or blocks are called local variable.
Variable s which are are declared in a class, but outside a method, constructor or any block are instance variables .
20. What is a package?
Package is a collection of related classes and interfaces.
<-Back Set 1 Next
java interview questions and answers Set 3 Coming soon ->
Facing difficulties in understanding the program ?
Ask Your Queries in Comment Box