class SomeClass
{
static public void someStaticMethod(){};
}
SomeClass SomeClass=new SomeClass();
SomeClass.someStaticMethod();
How to call the static method of any class where object name is same as class name?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t have to do anything – it will work as is (although it makes little sense to use such a confusing code).
How ambiguous names are handled is specified in the JLS #6.5.2. In particular:
So in your case,
SomeClasswill be the variable you declared one line above, which has priority over types.