Object And Class

1. Program

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

class A { int i ; public static void main(String args[]) { System.out.println(i); } }

2. Program

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

class B { void test() { } public static void main(String args[]) { test(); System.out.println("Hello World"); } }

3. Program

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

class C { int i; static void test() { System.out.println(i); } }

4. Program

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

class J { void test1() { System.out.println("from test1"); } static void test2() { J j1 = new J(); j1.test1(); System.out.println("from test2"); } }

5. Program

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

class E { int i; static { System.out.println(i); } }

6. Program

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

class F { void test1() { } static void test2() { test1(); } }

7. Program

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

class G { int i; public static void main(String args[]) { G g1 = new G(); System.out.println(g1.i); } }

Page....