// EXCEPTION
import javax.swing.*;
class exceptProg {
public static void main(String args[]) {
try
{
int no = Integer.parseInt(JOptionPane.showInputDialog(“enter a number:”));
int factorial=1;
for(int y = 1; y <= no; y++)
factorial *= y;
JOptionPane.showMessageDialog(null,”FACTORIAL : ” + factorial);
}
catch(Exception e) {
JOptionPane.showMessageDialog(null,”ERROR\n” + e);
}
finally {
JOptionPane.showMessageDialog(null,”END EXECUTION”);
}
} }
SAMPLE OUTPUT