In Java, why don't I need to import the RuntimeException in order to use it?

If I try to use IOException with no fully qualified name and no import, I get a compilation error. But that doesn't happen when I do the same thing like RuntimeException or Exception. Why is this?



source to share

1 answer

You cannot import classes from a package java.lang.

. It's not just RuntimeException, but things like Object and String.



All Articles