• Post Reply Bookmark Topic Watch Topic
  • New Topic

"Compiler" and RuntimeException  RSS feed

 
Benedikt Burgstaller
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

how does the java-compiler know, that an exception is a RuntimeException. As far as i know there is no special interface, etc that seperates the RuntimeExceptions from usual Exceptions. Does it distinguish them by name or how does this work?

thanks
benedikt
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

A Java compiler has to find a .java or .class file for every class (including exceptions) mentioned in a program it is compiling. Given the .class file, it can find out the superclass, and the superclass of that class... An exception type is unchecked if the compiler finds java.lang.RuntimeException or java.lang.Error in the tree of superclasses.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!