explain method overridding method overloding with examples?
Answer Posted / zurreyab ahmad
Ovloding:in overloding case same method name and different
parameter and different return type
public class overlo {
public void add(int a, int b)
{
System.out.println(a+b);
}
public float add(float c, float d)
{
return c+d;
}
}
class main1
{
public static void main(String[] args) {
}
}
Overriding:: in overriding case the same method name and
same parameter and same return type and in overriding case
at least two class must have
public class overri {
public void add(int a, int b)
{
System.out.println(a+b);
}
class overri1
{
public void add(int a, int b)
{
System.out.println(a+b);
}
}}
class main1
{
public static void main(String[] args) {
}
}
| Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
What does the term struts mean?
What is actionmapping?
How can we group related actions in one group in Struts?
How exceptions are handled in struts application?
What is the purpose of interceptors?
Explain about struts relation to html tags?
What does action do in struts?
When do I need “struts.jar” on my classpath?
Can we have multiple struts config files ?
What is struts2 in java?
What are different Struts2 tags? How can we use them?
What steps are required to for an application migration from Struts1 to Struts2?
What is controller in struts2?
How do I access token?
How struts 2 validation works?