File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Default Constructor

 
Mauro Trevigno
Ranch Hand
Posts: 96
Java Linux Tomcat Server
  • 0
  • 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
  • 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
  • 0
  • 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: 4549
8
Java Netbeans IDE Scala
  • 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
  • 0
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic