- class Lvar
- {
- int a;
- void access()
- {
- String b;
- System.out.println(a);
- System.out.println(b);
- }
- public static void main (String ...x)
- {
- Lvar x1 = new Lvar();
- x1.access();
- }
- }
- Output:
- Lvar.java:8: error: variable b might not have been initialized System.out.println(b); ^ 1 error
- class Lvar
- {
- int a;
- void access()
- {
- String b="NULL";
- System.out.println(a);
- System.out.println(b);
- }
- public static void main (String ...x)
- {
- Lvar x1 = new Lvar()
- x1.access();
- }
- }
- Output:
- 0
- NULL
- class Lvar
- {
- int a;
- void access()
- {
- String b="NULL";
- System.out.println(a);
- System.out.println(b);
- }
- public static void main (String ...x)
- {
- Lvar x1 = new Lvar();
- x1.access();
- }
- }
- Output:
| Copyright ©2016 | All Rights Reserved |
| Design by Uves Khan |