what is overloading in java?
Answer Posted / rajesh bonepalli
Overloading in java means creating the methods by same
method signature(name,return type) passing different
arguments/parameters.
Example :
public class Children {
public void getHabits(int k){
System.out.println("overriding in the children with
childrens behaviour int");
}
public void getHabits(){
System.out.println("overriding in the children with
childrens behaviour");
}
public void getHabits(double j){
System.out.println("overriding in the children with
childrens behaviour double");
}
public String getHabits(double j,double i){
System.out.println("overriding in the children with
childrens behaviour double");
return null;
}
}
| Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
What is files manifesting?
What are the differences between checked exception and unchecked exception?
Can we modify the throws clause of the superclass method while overriding it in the subclass?
Give any two differences between C++ and java.
What does yield method of the thread class do?
What does exp mean in math?
what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent
Why string is called as immutable?
What is a “stateless” protocol ?
How do you insert a line break?
Is Constructor possible in abstract class in java ?
what is an objects lock and which objects have locks? : Java thread
How to sort an array from smallest to largest java?
Why do we need wrapper classes?
What are decalarations?