Class constructor in java
Posted
by aladine
on Stack Overflow
See other posts from Stack Overflow
or by aladine
Published on 2010-06-08T02:26:25Z
Indexed on
2010/06/08
2:32 UTC
Read the original article
Hit count: 266
java
Please advise me the difference between two ways of declaration of java constructor
public class A{
private static A instance = new A();
public static A getInstance() { return instance;
}
public static void main(String[] args) {
A a= A.getInstance();
}
}
AND
public class B{
public B(){};
public static void main(String[] args) {
B b= new B();
}
}
Thanks
© Stack Overflow or respective owner