public class DoubleParserBug { static void attempt (String s) { System.out.println("Attempting to parse \"" + s + "\" as double"); try { double number = Double.parseDouble (s); System.out.println("value is " + number); } catch( NumberFormatException e ) { e.printStackTrace (); } } static public void main (String[] args) { attempt ("5"); attempt (" 5"); } }