Author
Question re: Identifiers
Mike Kelly
Ranch Hand
Joined: Jul 18, 2001
Posts: 78
posted Jul 23, 2001 10:40:00
0
Can a normal method be named the same as the class, and if so how can we tell it from a constructor?
herb slocomb
Ranch Hand
Joined: Feb 12, 2001
Posts: 1479
posted Jul 23, 2001 10:47:00
0
A method must have a return type, a constructor does not.
Junilu Lacar
Bartender
Joined: Feb 26, 2001
Posts: 4118
Yes, if you really want to confuse users of the class A normal method must have a return type (even if it is just void) while constructors can not have a return type. [This message has been edited by JUNILU LACAR (edited July 23, 2001).]
Junilu - [How to Ask Questions ] [How to Answer Questions ] [MiH ]
Mike Kelly
Ranch Hand
Joined: Jul 18, 2001
Posts: 78
posted Jul 23, 2001 12:09:00
0
Originally posted by herb slocomb: A method must have a return type, a constructor does not.
Thanks, got it.
Desai Sandeep
Ranch Hand
Joined: Apr 02, 2001
Posts: 1157
Mike, just donot think about it
<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
subject: Question re: Identifiers