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 role of void keyword in declaring functions?
Explain the transient field modifier?
What is a databasemetadata?
What state is a thread in when it is executing?
What’s meant by anonymous class?
Differentiate between vector and array list.
What is the difference between post and put?
How to reverse string in java?
What is pass by value?
Difference between string, string builder, and string buffer?
Can we override the private methods?
How can I right-justify a string?
Is null keyword in java?
What is the relationship between class and object?
What language is java written?