can someone help me how how can catch CTRL C and print it out then stop the program?
Thanks
/**
* 218-102 Lab 7
* TestCircle.java
*
* @author JKang & JLeone
*
*/
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class TestCircleB {
public static void main(String [] args) {
// read a radius of the circle from command line
try {
Scanner in = new Scanner (System.in);
System.out.print("Enter a circle radius : ");
double radius = in.nextDouble();
// Instantiate a Circle object
Circle aCircle = new Circle(radius);
// Print current status of the circle
System.out.println(aCircle);
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Array Index Out Of Bounds Exception Occured ...");
}
catch (ShapeException e) {
System.out.println("Shape Exception Occured ...");
}
catch (NumberFormatException e) {
System.out.println("Number Format Exception Occurred ...");
}
catch (InputMismatchException e) {
System.out.println("Input Mismatch Exception Occured ...");
}
/*
catch (InterruptedException e)
{
e.printStackTrace();
System.out.println("Input Mismatch Exception Occured ...");
}
*/
catch(InterruptedException e) {
// Restore the interrupted status
Thread.currentThread().interrupt();
}
}
}