| 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]
|
 |
 |
|
|
subject: CONSTRUCTORS WITH DIFFERENT NAME FROM ITS CLASS
|
|
|