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 is apache struts vulnerability?
How is the action mapping specified?
Give an example where struts tiles may be used?
what is ACID test for fresh engineers??what is the pattern??
Which configuration files are used in struts?
Explain about how requests from the client are sent?
What is the purpose of @urlvalidator annotation?
What is execute method in struts?
Why is action servlet a singleton in struts?
What is the difference between Jakarta Struts and Apache Struts? Which one is better to use?
Are struts thread safe?
Define struts?
What is filter dispatcher in struts?
What is the purpose of @conversion?
What does action do in struts?