CHECKED EXCEPTION - A checked exception is any exception that is checked by the Java compiler at compile time. Your programs will not compile until these exceptions are handled. e.g. having to surround FileWriter in a try/catch block.
FileWriter w = null;
try {
w = new FileWriter("file.txt");
} catch (IOException e) {
e.printStackTrace();
}
UNCHECKED EXCEPTION - Basically, any exception that is not checked by the compiler. These exceptions are the ones that blow up in your face at run time. Hint: RuntimeException - NullPointedException, IndexOutOfBoundsException, etc.
TYPE ERASURE - Fancy name for a simple compiler trick. All it means is that when you write with generics in Java:
List<String> groceries = new ArrayList<String>();
groceries.add("milk");
String s = groceries.get(0);
The compiler turns it to this:
List groceries = new ArrayList();
groceries.add("milk");
String s = (String) groceries.get(0);
The bytecode for both examples are identical due to "type erasure". Nothing complicated.

New Topic/Question
Reply



MultiQuote


|