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

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "private constructers" Watch "private constructers" New topic

private constructers

gopala krishna muvvala

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)
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

Joined: Oct 13, 2005
Posts: 41640
Welcome to JavaRanch
There was similar discussion last week: here.
It is sorta covered in the JavaRanch Style Guide.
subject: private constructers