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


Please Help Members By Posting Answers For Below Questions

How is declarative handling of exceptions done in struts ?

478


What are the sections into which a strut configuration file can be divided?

556


What do struts do?

521


At the point, you should go for struts framework?

549


What is an interceptor stack?

575






Which interceptor is responsible for mapping request parameters to action class Java Bean properties?

558


How to upload struts file?

604


Can explain about the validations and in your project where did u used the validations?

6405


How can we upload files in Struts2 application?

586


What types of validations are available in xml based validation in struts2?

550


What is struts.devmode?

575


What is the purpose of form-beans tag in struct-config.xml?

551


What are different ways to create Action classes in Struts2?

593


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

2755


What is filter dispatcher in struts?

535