I have the following code :
class Exception
{
public static void main(String args[])
{
int x = 10;
int y = 0;
int result;
try{
result = x / y;
}
catch(ArithmeticException e){
System.out.println("Throwing the exception");
throw new ArithmeticException();
}
}
}
The name of the class is 'Exception'. This is the same as java.lang.Exception which is imported by default into the program. Then why does this program compile with two classes having effectively the same name?