Quantcast
Channel: Go4Expert
Viewing all articles
Browse latest Browse all 1987

variable exception in java

$
0
0
why do you need a variable in catch exception and how do you use each it the same as the detailed exception?

TemperatureException and e
TooColdException and e

for example:
Code:
try {
            cust.drinkCoffee(cup);
            System.out.println("Coffee is just right.");
        }
        catch (TemperatureException e) {
            // This catches TooColdException, TooHotException,
            // as well as TemperatureException.
            System.out.println("Coffee is...
variable exception in java

Viewing all articles
Browse latest Browse all 1987

Trending Articles