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 {
    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!

Advertisements