13_Review Lecture

Why try catch exception e3 catch arithmeticexception

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: y throw exceptions } catch (Exception1 exVar1) { handler for exception1; } catch (Exception2 exVar2) { handler for exception2; } ... catch (ExceptionN exVar3) { handler for exceptionN; } 10 Be Careful with Mul4ple Excep4ons   Note that the following will produce a compiling error. Why? try {…} catch (Exception e3) {…} catch (ArithmeticException e1){…} catch (IOException e2) {…} MultipleException Generics Review points •  Basic syntax of declaring/using a generic type. •  Basic syntax of declaring/using a generic method •  Wild card matching and support of polymorphism –  Bounded parameter types –  ? super/extends –  PECS principle Generic Type Runtime error Generic Instan4a4on Improves reliability Compile error GenericMotivation 14 _interfaces.ComparableRectangle, ComparableRectangleWithGeneric Generic ArrayList in JDK 1.5 15 No Casting Needed ArrayList<Double> list = new ArrayList&l...
View Full Document

This document was uploaded on 03/11/2014.

Ask a homework question - tutors are online