Let's look at the bytecode to see if there is a difference:
Compiled from "ABC.java"
public class playground.ABC {
public playground.ABC();
Code:
0: aload_0
1: invokespecial #8 // Method java/lang/Object."<init>":()V
4: return
public static int getSomeNumber();
Code:
0: bipush 10
2: ireturn
public static void anotherMethod();
Code:
0: invokestatic #17 // Method getSomeNumber:()I
3: pop
4: invokestatic #17 // Method getSomeNumber:()I
7: pop
8: return
}
The description of invokestatic
says: The arguments
(...) are used to construct an index
into the run-time constant pool of the current class. (...) The run-time constant pool item at that index must be a symbolic
reference to a method or an interface method (...), which gives
the name (...) of the method as well as a
symbolic reference to the class or interface in which the method is
to be found. The named method is resolved.
Both calls are reffering to the same item (#17
) of the constant pool in the same way. There is no difference in the bytecode whether the static local method getSomeNumber
is called qualified or unqualified.