1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
/* Java Final variable example This Java Example shows how to declare and use final variable in a java class. */ public class FinalVariableExample { public static void main(String[] args) { /* * Final variables can be declared using final keyword. * Once created and initialized, its value can not be changed. */ final int hoursInDay=24; //This statement will not compile. Value can't be changed. //hoursInDay=12; System.out.println("Hours in 5 days = " + hoursInDay * 5); } } /* Output would be Hours in 5 days = 120 */ |
heloooooooooooo
Can someone tell me if this class can compile at all.
For me it seems that even when im not touching int and i type something like
System.out.println(“Hello world”); it wont compile.?