UNB/ CS/ David Bremner/ teaching/ old/ cs1083/ java/ Catch3.java
import java.util.Scanner;
public class Catch3 {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        boolean ok = false;
        while(!ok){
            System.out.println("enter a number");
            String s=sc.next();
            ok=true;
            try{ double d=Double.parseDouble(s); }
            catch (NumberFormatException e){
                System.out.println("Not a number!");
                ok=false;
            }
        }
    }
}