Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes CONSTRUCTORS WITH DIFFERENT NAME FROM ITS CLASS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "CONSTRUCTORS WITH DIFFERENT NAME FROM ITS CLASS" Watch "CONSTRUCTORS WITH DIFFERENT NAME FROM ITS CLASS" New topic
Author

CONSTRUCTORS WITH DIFFERENT NAME FROM ITS CLASS

Richard Teston
Ranch Hand

Joined: Feb 12, 2002
Posts: 89
Can constructors can have a different name from it's class?
Just wondering....


The Code is the Programmer
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

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,


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
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!


Rob
SCJP 1.4
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
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.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CONSTRUCTORS WITH DIFFERENT NAME FROM ITS CLASS
 
Similar Threads
Constructor
Diffrence b/w constructor and method Breiefly
private constructors
Questions for you
differnce between constructor and method