I learnt that ,whenever we call a static method from another static method we call it directly using its method name without using any object of the class in which that method resides.But now my doubt is what if we have same method name which is also static resides in other class. Now won't the compiler gets confused to which method it should go when we call one of those methods since they have same name and we are not refering them using their class objects ?
I'm guessing your question is about static imports? There is no way to call a static method in another class without using the class name, unless you statically import the method. When you use multiple static imports of the same name you get a compilation error because the method is ambiguous. If your class contains a static method with the same name, that is the one called and the static imports are ignored.