• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Default Constructor

 
Mauro Trevigno
Ranch Hand
Posts: 99
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi People,

What class has a default constructor?



Thanks.
 
Enkita mody
Ranch Hand
Posts: 333
Firefox Browser Java Windows XP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your first class has default constructor.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 4566
8
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default constructor is inserted by the compiler if you do not provide any constructor yourself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic