Final in Java can refer to variables, methods and classes. The final keyword is used in several contexts to define an entity that can only be assigned once. Once a final variable has been assigned, it always contains the same value.
There are three simple rules :
//Final Variables in Java class Test { final int MIN=1; final int NORMAL; final int MAX; Test(int normal) { NORMAL = normal; MAX =100; } void display() { System.out.println("MIN : "+MIN); System.out.println("NORMAL : "+NORMAL); System.out.println("MAX : "+MAX); } } public class finalTest { public static void main(String args[]) { Test o =new Test(50); o.display(); } }
MIN : 1 NORMAL : 50 MAX : 100To download raw file Click Here
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions