- A java variable can be declared using the keyword final. Then the final variable can be assigned only once.
- A variable that is declared as final and not initialized is called a blank final variable. A blank final variable forces the constructors to initialise it.
- Java classes declared as final cannot be extended. Restricting inheritance!
- Methods declared as final cannot be overridden. In methods private is equal to final, but in variables it is not.
- final parameters – values of the parameters cannot be changed after initialization. Do a small java exercise to find out the implications of final parameters in method overriding.
- Java local classes can only reference local variables and parameters that are declared as final.
- A visible advantage of declaring a java variable as static final is, the compiled java class results in faster performance.
বৃহস্পতিবার, ৫ জানুয়ারী, ২০১২
Java Final Keyword
এতে সদস্যতা:
মন্তব্যগুলি পোস্ট করুন (Atom)
http://javapapers.com/core-java/explain-the-final-keyword-in-java/#&slider1=1
উত্তরমুছুনfinal in java is a tricky keyword if used carefully it can boost performance of Java application. I have also shared my view as final keyword in Java let me know how do you find it.
উত্তরমুছুন