If Class Name & Method Name are same?

Any guess for the code below? Will it compile or run time error?

package SchoolHood;  // SchoolHood as package name

public class SchoolHood {
      System.out.println("SchoolHood--As a Constructor.");

    public void SchoolHood(){
      System.out.println("SchoolHood--As a Simple Method");

    public static void main(String[] args) {
      System.out.println("SchoolHood--As a Class Name");
      new SchoolHood().SchoolHood();

Program written above is absolutely right. Package/Class/Method name may be the same as they share different namespaces. Hence no issue.
Seems to be some1 is loving the name rather than the ethics of programming. Aaahhhhh!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s