During my Java learning, I tried this piece of code which compiled & ran successfully. Can anybody please provide an explanation that why hasn't the compiler generated any error? I imported the complete package which includes java.util>Scanner as well, so shouldn't there be an error that the Scanner is already defined in util package & I'm trying to redefine it here?
import java.util.*;
class Scanner
{
public static void main(String... args)
{
Scanner c = new Scanner();
}
}
My Java basics are not very clear so kindly bear if this appears to be completely a noob's question and there was no question alike on this forum so I thought to better ask it.