how can i access a private contructor.please give a sample
Is private, only the class may access a private constructor.
you can use a private constructor from public constructor for example,but no direct way, as far as i know,,,
u can access a private conustructor by making a call from oneof the public constructor of that class and using that constructor to create anobject of that class. u have to place a call to that private constructor fromwhich ever constructor u want.
See this sample code--Class A{private A(){}public static A CreateObject(){return new A();}}Class B{public static void main(String arg[]){A a=A.CreateObject();}}Hope u would get it. Well why do u need this actully this is used forsingletone pater n the code whc i hav given here is not exactlysingleton of pattern. (I can do tht also).