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
How you will make available any message resources definitions file to the struts framework environment?
What is struts2 in java?
What is interceptor in Struts2?
What are the 5 constants of action interface?
What does i18n interceptor?
What does execandwait interceptor?
What is the purpose of @createifnull annotation annotation?
Who makes the struts?
What steps are required to for an application migration from Struts1 to Struts2?
How struts 2 validation works?
How do I access token?
Which model components are supported by Struts?
What is the purpose of constant tag in struts.xml?
What are action errors?
What are action errors and error?