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   SiteMap shows list of All Categories in this site.
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 finalmethod & final variable with example?
 Question Submitted By :: Gopalraop
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is finalmethod & final variable with example?
Answer
# 1
Final method cannot be overridden by subclasses. This is 
used to prevent unexpected behavior from a subclass 
altering a method.

Example:

public class MyClass {
    public final void myFinalMethod() {...}

Final Variable, it can only be assigned to once and only in 
the constructor of class if variable is not a reference to 
pther object.

Example:

public class Sphere {
 
    public static final double PI = 3.141592653589793;  // 
this might as well be a constant
    public final double radius;
    public final double xpos;
    public final double ypos;
    public final double zpos;
 
    Sphere(double x, double y, double z, double r) {
         radius = r;
         xpos = x;
         ypos = y;
         zpos = z;
    }
 
Is This Answer Correct ?    4 Yes 0 No
Aditi
 
  Re: what is finalmethod & final variable with example?
Answer
# 2
public final methodA(){

}
u can overirde final method & final variable can reassigned 
another value & final varaiable value must be assingend at 
the time of declaration
 
Is This Answer Correct ?    1 Yes 3 No
Dipesh
 
 
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
What class is used to implement a Throwable array?  3
As a developer what steps do you take to improve the performance?  3
what is the difference between statis block and static variable  5
What is Exception handling in Java How do you handle run time errors please explain with an example TCS2
what are the oops concept in java explain with real time examples Tech-Mahindra4
I need to know about complete topic in java's collections i with an examples TCS1
Can an abstract class be final?  6
What is static binding and where it occurs?  2
how session will be expired? Infosys4
can anyone explain me the concept of autoboxing?  3
What is Remote Interface ? CTS4
what is marker interface ? what is the necessity of it? Accenture4
How to call static method? Epoch3
What is meant by event handling?  1
which one the better thread emplemented thread or extended ? Fidelity3
What is a Wrapper class?  9
can we have function for truncating the sign as like abs in oracle.  1
How to prevent a field from serialization ?  2
How to override a equals() method and what is the use?  1
Differentiate Vector and ArrayList? Wipro4
 
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