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
Can a main method be overloaded?
What are the methods used to implement for the key object in the hash map?
What happens if an exception is not handled in a program?
What is a ternary operator in java? What is an interface?
What is the difference between state-based unit testing and interaction-based unit testing?
Why is singleton instance static?
What is the association?
Is it possible to compare various strings with the help of == operator?
Is space a character in java?
What are the benefits of operations in java?
What is meant by binding in rmi?
When we serialize an object does the serialization mechanism saves its references too?
Explain jvm, jre, and jdk?
What is java in detail?
What is the difference between an argument and a parameter?