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


Please Help Members By Posting Answers For Below Questions

What is role of void keyword in declaring functions?

821


Explain the transient field modifier?

800


What is a databasemetadata?

734


What state is a thread in when it is executing?

739


What’s meant by anonymous class?

854


Differentiate between vector and array list.

857


What is the difference between post and put?

784


How to reverse string in java?

878


What is pass by value?

722


Difference between string, string builder, and string buffer?

763


Can we override the private methods?

758


How can I right-justify a string?

867


Is null keyword in java?

740


What is the relationship between class and object?

786


What language is java written?

779