aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question re: Identifiers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
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?
frank davis
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: 5018
    
    8

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]
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Question re: Identifiers