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

can used Protected Class outside Function.?

614


Why string is a class?

548


Can we use catch statement for checked exceptions?

514


Is void a data type?

538


Can a static block throw exception?

653






What is string syntax?

549


Who is founder of java?

532


What is int lol?

594


What is java virtual machine and how it is considered in context of java’s platform independent feature?

654


I want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?

521


Which container method is used to cause a container to be laid out and redisplayed in java programming?

603


Does java support function overloading, pointers, structures, unions or linked lists?

607


Explain the purpose of garbage collection in Java?

571


What is methods and methodology?

533


Can we assign null to double in java?

549