Question:
What is final method?
Answer:
Final method: Final method is a method ,which cannot be overridden in the sub classes. Submitted by DEVARATHNAM.C - S.V.UNIVERSITY.,TIRUPATI ([email protected])
__________
A Method which is declared as final cannot be overridden.
Example
public class A {
public final void something(){
System.out.println(“hi there”);
}
}
public class B{
public final void something(){ // THIS IS NOT ALLOWED
System.out.println(“hi B there”);
}
}
Submitted by Arun Pasuparthi ([email protected]) Source: CoolInterview.com
If we deffine the final method then we can't override this method. Source: CoolInterview.com
Answered by: Vishva Deepak Tripathi | Date: 4/8/2009
| Contact Vishva Deepak Tripathi
a final method is that it should not be inherited into the sub class Source: CoolInterview.com
Answered by: gopal | Date: 2/24/2010
| Contact gopal
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|