Java examples for Object Oriented Design:Exception
Parse String value to float value.
Handle an exception inside a catch block.
public class Main { public static void main(String[] arguments) { try {/*from w w w . j a v a2 s .c o m*/ float in = Float.parseFloat("aa"); // rest of method } catch (NumberFormatException nfe) { System.out.println(" not a valid number."); } } }