File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question re: Identifiers Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Question re: Identifiers" Watch "Question re: Identifiers" New topic
Author

Question re: Identifiers

Mike Kelly
Ranch Hand

Joined: Jul 18, 2001
Posts: 78
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
A method must have a return type, a constructor does not.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4118
    
    2

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
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>
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Question re: Identifiers
 
Similar Threads
error in Marcus Green 2.
Private methods
Can the color for the disabled item be changed
WA #1.....word association
URGENT - NEED HELP - Block Code