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

Explain about main thread in java?

863


Differece between class and generic class?

785


Is ++ operator is thread safe in java?

699


what is the final keyword denotes in java?

790


What is the purpose of a parameter?

782


Differences between traditional programming language and object oriented programming language?

820


How do you get length in java?

781


Is array serializable java?

719


What data structures are used to perform recursion?

804


Is array an object in java?

728


Can we override static methods in java?

811


What does flag mean in java?

743


How do you check if a string contains only numeric digits?

867


Is char * a string?

744


How to add menushortcut to menu item?

741