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 are the benefits of Interceptors in Struts2?
What is Struts2?
What’s the difference between struts and turbine? What’s the difference between struts and espresso?
What is the apache struts vulnerability?
Which design pattern the interceptors in struts2 is based on?
Explain how to work with error tags?
How we can controlled duplicate form submission in struts?
What is the purpose of @createifnull annotation annotation?
What is front controller in struts?
Which model components are supported by Struts?
What are the different kinds of actions in struts?
Explain the difference between dispatchaction and lookupdispatchaction in struts?
What is difference between struts1 and struts2?
Are struts and shocks the same?
What is the purpose of @emailvalidator?