see this question about static object

1)static A a =new A();2) A a1=new A();what is the difference between them?
[95 byte] By [sudha_1234a] at [2007-10-2 21:54:34]
# 1
http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html
pbrockway2a at 2007-7-14 1:10:31 > top of Java-index,Java Essentials,New To Java...
# 2

static A a =new A();

When this line is written in another class say : class b;

a is accessible without the need for declaring an object of b.

i.e., b.a

Not in the other case.

Many factory classes and methods are accessed this way coz, the classes are private and abstract, so u cannot make an object of that class.

For example:

System.out.println() - here println() is a method, out is an object of some class that is declared static in the class System. if it were'nt static, then we had to make an object of the System class and then access the out object,

hope this helps

let me know

ramya_patkia at 2007-7-14 1:10:31 > top of Java-index,Java Essentials,New To Java...
# 3
Special thanks for giving answer . Regards Sudhakar Reddy(sudha).
sudha_1234a at 2007-7-14 1:10:31 > top of Java-index,Java Essentials,New To Java...