programming-examples/java/Basics/Pie Maker.java
2019-11-18 14:44:36 +01:00

28 lines
671 B
Java

Pie Maker
package com.ack.learning.exceptions;
import com.ack.learning.exceptions.PieEater;
import com.ack.learning.exceptions.PieException;
public class PieMaker {
public static void main( String[] args ) {
try {
PieEater pie = new PieEater();
// some processing
System.out.println( pie.howManyPies() );
}
catch( PieException pex ) {
// catch the PieException and printout its stack trace
pex.printStackTrace();
}
finally {
// and always print out 'no more pies', regardless of what
// happens within the try block
System.out.println( "no more pies" );
}
}
}