Because Stringin your local package takes precedence; you can explicitly use java.lang.Stringor call yours class Stringsomething else 1 .
public static void main(java.lang.String[] args)
To expand above, at compile time, the compiler resolves class names in their full form ( imports does not exist at the bytecode level ). In addition, Java includes a static pool Stringthat is initialized before loading your class (in order for this to function, it java.lang.Stringmust be loaded before any custom classes).
1 What's really better is shadowing classes from java.langrequesting a service nightmare.
source
share