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 a for loop in java?
Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?
What is polymorphism in java? What are the kinds of polymorphism?
Is string pool garbage collected?
What is type inference in java8?
How to compare strings in java?
What is the difference between JVM and JRE?
Is a class subclass of itself?
What is constructor and virtual function? Can we call a virtual function in a constructor?
What are actual parameters?
What is java volatile?
What is static keyword?
What does you mean in math?
What is the point of java?
List two java ide’s?