aspose file tools*
The moose likes Beginning Java and the fly likes private constructers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "private constructers" Watch "private constructers" New topic
Author

private constructers

gopala krishna muvvala
Greenhorn

Joined: Aug 26, 2008
Posts: 3
Is possible to create object for private constructer in java

in this way

class demo
{
private demo(String s)
{
System.out.println(s);
}
public static void main(String[] ar)
{
demo d=new demo("gopal");
}
}
[ August 26, 2008: Message edited by: gopala krishna muvvala ]
satishkumar janakiraman
Ranch Hand

Joined: May 03, 2004
Posts: 334
Yes. Objects can be created in the class itself. Check Singleton pattern for more information
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38726
    
  23
Welcome to JavaRanch
There was similar discussion last week: here.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: private constructers