| Author |
same class n method name
|
usha prithvi
Ranch Hand
Joined: Jun 22, 2005
Posts: 31
|
|
hi, Though itz not a compiler error, for the class and the method to have the same name, y is it not preferred?(the editor says"method has a constructor name") can someone explain me this? Thankz
|
 |
Srinivasa Raghavan
Ranch Hand
Joined: Sep 28, 2004
Posts: 1228
|
|
|
Constructor is a method that has the same name as the class name. So if you are having a method with same name as the class name but with a return type, it decreases the clarity of the code and leads to confusion so it's better to avoid that.
|
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
|
 |
usha prithvi
Ranch Hand
Joined: Jun 22, 2005
Posts: 31
|
|
|
Itz more clear to me now.Thankz for the explanation.
|
 |
 |
|
|
subject: same class n method name
|
|
|