ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
what is mean by overriding in which situation we wil use?
 Question Submitted By :: Rajmohan
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is mean by overriding in which situation we wil use?
Answer
# 1
If we have same method name in the super class as well as 
in the sub class, then the method in the subclass is said 
to override the method in the super class.
 
Is This Answer Correct ?    2 Yes 1 No
Neema
 
  Re: what is mean by overriding in which situation we wil use?
Answer
# 2
override methos have same method name with same 
signature.which methods are apper in super class to sub 
class.
 
Is This Answer Correct ?    2 Yes 0 No
Ramana
 
 
 
  Re: what is mean by overriding in which situation we wil use?
Answer
# 3
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 ?    2 Yes 0 No
Vikas
 
  Re: what is mean by overriding in which situation we wil use?
Answer
# 4
According to J2ee Compleet reference java:
I Think the  answer is that
Overriding means the : In inheritance  If we Declare the
(Public of default)  Method in the superclass Similarly we 
declare the method with the same name ,Same type,same 
number of parameters.but the Body of the method May 
different When We Instansiate child class and access it 
then child's method will called if u want to call super's 
overriden method then use the [super()] method to access it 
in child  for this read [Java compleete reference's 
Chapter#8] u will find reasonable answer
 
Is This Answer Correct ?    1 Yes 0 No
Shahbaz Ali
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Can we declare variables inside a method as Final Variables?  2
what is difference between class and object?  5
Can you explain the difference b/n abtract and interface with a good example,?In what cases we have use abtract and what case interface? Satyam1
what is wrapper class and its uses?  2
Differentiate Vector and ArrayList? Wipro3
what is Thread?  3
why abstract class will have a constructor?  2
which method throws exception of type Throwable  2
what is request processor? Virtusa1
how to pass the parameters to applets?  1
I have a class which is abstract which contains only the abstract methods. This is similar to an interface. Then, if i have given a choice to choose one of them. Which one i have to choose and why?  4
what is difference between method overloading & method overridding with example? IBM2
Why Java is a platform independent language? Zensar4
After compilation of java program we'll get .class code. If it's generated in OS Windows XP will it work on OS Linux? If yes why? If no why? Aricent3
What is a thin-client application? Adobe3
what is the difference between Cpp And Java Infosys3
What is clipping?  2
What is the use join() in Threads ? HCL3
what is Vector class?  2
How do u provide security in java  1
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com