jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Default Constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Default Constructor" Watch "Default Constructor" New topic

Default Constructor

Mauro Trevigno
Ranch Hand

Joined: Aug 27, 2012
Posts: 94

Hi People,

What class has a default constructor?

Enkita mody
Ranch Hand

Joined: Aug 06, 2012
Posts: 333

Your first class has default constructor.

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Mauro Trevigno wrote:
What class has a default constructor?

I can remember one : java.lang.Object . in fact one.
<edit> removed word only </edit>
Matthew Brown

Joined: Apr 06, 2010
Posts: 4541

The "default constructor" is the one automatically inserted by the compiler if you don't provide one yourself. So it's the first example. The second is a parameterless (or no-arg) constructor, but because you've provided it it isn't considered a default one.
James Boswell

Joined: Nov 09, 2011
Posts: 1051

The default constructor is inserted by the compiler if you do not provide any constructor yourself.
I agree. Here's the link: http://aspose.com/file-tools
subject: Default Constructor
It's not a secret anymore!