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 is declarative handling of exceptions done in struts ?
What are the sections into which a strut configuration file can be divided?
What do struts do?
At the point, you should go for struts framework?
What is an interceptor stack?
Which interceptor is responsible for mapping request parameters to action class Java Bean properties?
How to upload struts file?
Can explain about the validations and in your project where did u used the validations?
How can we upload files in Struts2 application?
What types of validations are available in xml based validation in struts2?
What is struts.devmode?
What is the purpose of form-beans tag in struct-config.xml?
What are different ways to create Action classes in Struts2?
1.can we transfer a request from one struts application to another struts application? 2. how many types of action servlets r there what r they
What is filter dispatcher in struts?