save up to 40%

What are final variables?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

What are final variables?

Rating:

Variables declared with the keyword final as a modifier are called final variables. They are so called because once initialized a value, their values cannot be modified. Any attempt made to modify the value of a pre-initialized final variable will result in a compile time error.

A final variable is declared as shown below:

final double IAMFINAL=0;

where, IAMFINAL is the name of variable whose data type is double. This statement declares the variable IAMFINAL as final and initializes it with the value 0 at the same time. Further attempts to change the value of IAMFINAL will result in a compile time error.

Note: The concept of final variables in Java is similar to constants in other programming languages.


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.