This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Difference between Default & Zero Constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between Default & Zero Constructor" Watch "Difference between Default & Zero Constructor" New topic
Author

Difference between Default & Zero Constructor

faisal usmani
Ranch Hand

Joined: Jan 14, 2006
Posts: 139
Hi ,

I am not sure but i think there is a difference between a zero argument constructor given by a developer and the default constuctor made by Java compiler if no constuctor is given inside a class .


Can anybody of you help in understanding the difference between the two .

thanks is advance

Look at all the sentences which seem true and question them.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

If you define one yourself, it can be public, protected, private, or default, and of course, it can contain arbitrary code. If you leave it up to the compiler to define one, it will be public if the class is public, or default-protected otherwise, and contain no code. But aside from that, there's no difference.


[Jess in Action][AskingGoodQuestions]
faisal usmani
Ranch Hand

Joined: Jan 14, 2006
Posts: 139
Thanks Ernest , i got the point .


I have always depended on the kindness of strangers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between Default & Zero Constructor