aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes same class n method name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "same class n method name" Watch "same class n method name" New topic
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: same class n method name
 
Similar Threads
What will be the name of .java file?
Constructor overloading
Abstract class??
constructor with return value
[solved]warning message:" Accessing static method numbers" #7th floor