here is some code plz observe it
1. class abc
2. {
3. static int a=10;
4. static abc ob=new abc();//static object instantiation
5. public static void main(
String args[])
6. {
7. ob.method();
8. }
9. public void method()
10. {
11. ob=new abc();// compiles and run
12. System.out.println(" a = "+a);// direct refence error
13. System.out.println(" a = "+ob.a);// with object still error
14. }
15. }
as
java says that static members can't be refenced by non-static
methods. so why static objects as in line (10)are accessed by non-static method.as static variable is not at line (12,13),wheteher called directly or with the refence of object.
so i can't understand this behaviour of static.
can any body explain.
thanx in advance.