Note: (Restricted functionality due to obvious reasons!)
Minimal Code ( Raw-View ) :
final class CDimension // bcoz of 'final' this class can't be inherited..!
{
int a,b;
final int h=10; // final variable
CDimension(int x, int y)
{
a=x;
b=y;
}
void display()
{
System.out.println("L = "+a);
System.out.println("B = "+b);
System.out.println("H (final) = "+h);
}
}
class FinalClassnVar
{
public static void main(String z[])
{
CDimension obj = new CDimension(10,20);
obj.display();
obj.a =90; // this change results updation because var'a' is not 'final'
//obj.h=23; -> gives error bcoz 'h' is 'final' and it can't be updated.. !
System.out.println("Value of obj->a = "+obj.a);
}
}