This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Java in General and the fly likes re:constructors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "re:constructors" Watch "re:constructors" New topic
Author

re:constructors

ashish sood
Greenhorn

Joined: Oct 03, 2009
Posts: 8
please help me with basic concepts of constructors like------>
can they be declared private???
can they be declared static???
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

ashish sood wrote:
can they be declared private???
can they be declared static???


Did you try out writing a test class with constructors which fit these criteria? Did it compile? Did you get any errors?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
ashish sood
Greenhorn

Joined: Oct 03, 2009
Posts: 8
yes i did...
the program compiled successfully with "private" but failed with "static" modifier
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Question answered :)

The next step is to think about situations where we might want private constructors, since it might seem counter-intuitive not to allow people to instantiate an instance of a class...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: re:constructors