Final Keyword

22. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class V { final int i; V() { i = 0; } }

23. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class W { final int i = 0; W() { i = 0; } }

24. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class X { final int i; X() { i = 0; } X(int i) { this(); } }

25. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class Y { final int i; Y() { i = 10; } Y(int i) { this(); i = 10; } Y(int i, int j) { this(); i = 10; j = 20; } public static void main(String a[]) { Y y1 = new Y(); System.out.println("hello"); } }

26. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class Z { final int i; Z() { i = 10; } Z(int j) { i = 10; } }

27. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class Z1 { final int i; Z1() { i = 10; } Z1(int i) { this.i = 10; } }

28. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class Z3 { final int i; { i = 10; } { i = 10; } }

28. Program

//Find what it gives Compiletion Error / Compiletion Successfully / Output ?

class Z5 { final int i; Z5() { i = 10; } { i = 10; } }

Page....