Difference between a static and a final static variable in


Difference between a static and a final static variable in Java? Unable to differentiate between a final and a final static member. The final static member is the one which is a static member declared as final or something else? The following segment of code accordingly, will not be compiled and an compile-time error will be issued by the compiler, if an attempt is made to compile it.

public static void main(String args[])

{

final int a=0;

//ok int b=1; //

ok static int c=2;

//wrong final static

int x=0; //wrong

}

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Difference between a static and a final static variable in
Reference No:- TGS02153198

Now Priced at $20 (50% Discount)

Recommended (96%)

Rated (4.8/5)