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

CONSTRUCTORS WITH DIFFERENT NAME FROM ITS CLASS

 
Richard Teston
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can constructors can have a different name from it's class?
Just wondering....
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No they can't.
Richard, please review JavaRanch's naming policy and change your name in your profile to an acceptable format (FirstName LastName).
Thanks,
 
Rob Ross
Bartender
Posts: 2205
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to throw in something here....constructors are not inherited either, nor can they return a value, although you can have a method with the same name as a constructor and with a return value, which looks like a constructor but is not. Sneaky little bug that one!
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Ross:
Just to throw in something here....constructors are not inherited either, nor can they return a value, although you can have a method with the same name as a constructor and with a return value, which looks like a constructor but is not. Sneaky little bug that one!


Thank you for that tidbit, Rob. That's a good one to tuck away for exam day, etc.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic