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

Write a function for palindrome and factorial and explain?

1075


Tell me are there implementations for sorting and searching in the java libarary?

1034


How do you escape json?

993


Who developed java?

987


Is it possible to compare various strings with the help of == operator?

993


Do we have pointers in java?

973


we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.

2030


What is a static class in java?

1010


Where import statement is used in a java program?

1123


What is the default size of load factor in hashing based collection?

1049


Is class forname reflection?

990


What is java util collection?

1086


Explain about procedural programming language or structured programming language and its features?

1096


Write a program to search a number in the given list of numbers.

1029


What is the main use of java?

1167