Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is mean by overriding in which situation we wil use?

Answer Posted / vikas

Overriding means, In a derived class, if we include same
method name, with same number & types of parameters and
return type as a method already defined in the base class,
then the method is said to be Overridden.

base class:

class Circle {
protected double radius;

public double getArea() {
return Math.PI*radius*radius;
}//this method returns the area of the circle
}

derived class:

class Cylinder extends Circle {

protected double length;

public double getArea() { // method overriden here
return 2*super.getArea()+2*Math.PI*radius*length;
}//this method returns the cylinder surface area
}

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the exact difference in between Unicast and Multicast object? Where will it be used?

1062


What is the purpose of the system class in java?

1048


What is runtime locatable code?

1437


You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain

994


Why for each loop is used?

1014


What is the main difference between java platform and other platforms?

1107


What are the types of collections in java?

1057


What is nested interface?

1012


What is temp in java?

1006


What is meant by the value of a variable?

921


What is difference between path and classpath?

1179


What is the inheritance?

975


what are synchronized methods and synchronized statements? : Java thread

1000


Difference between java and javascript

1103


What is a line break example?

1002