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 the super void?

463


How do you take thread dump in java?

564


What is a values collection view ?

685


Is array an object in java?

556


How listener identify that the event came from a particular object?

1475






How do you start a new line in java?

523


Can we restart a thread already started in java?

584


What is a parameter in java?

550


What is the difference between jfc & wfc?

599


Why arraylist is used in java?

553


what is the messsage u r going to get from an objectoriented programing?

1617


What is get () in java?

574


How to split a string in java?

632


What is java lang string?

552


How do you declare an empty string?

624