From: SourceForge.net <no...@so...> - 2004-11-25 23:14:26
|
Bugs item #1073472, was opened at 2004-11-25 23:14 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1073472&group_id=44253 Category: Interactions Group: Crashes Status: Open Resolution: None Priority: 5 Submitted By: Steven Muller (boppoly) Assigned to: Nobody/Anonymous (nobody) Summary: Console Scanner Locks up Interactions Pane Initial Comment: // Try the following example program import java.io.*; import java.util.*; /** Demonstrate the Scanner class for input of numbers.**/ public class ScanConsoleApp { public static void main (String arg[]) { // Create a scanner to read from keyboard Scanner scanner = new Scanner (System.in); try { System.out.printf ("Input int (e.g. %4d): ",3501); int int_val = scanner.nextInt (); System.out.println (" You entered " + int_val +"\n"); System.out.printf ("Input float (e.g. %5.2f): ", 2.43); float float_val = scanner.nextFloat (); System.out.println (" You entered " + float_val +"\n"); System.out.printf ("Input double (e.g. % 6.3e): ",4.943e15); double double_val = scanner.nextDouble (); System.out.println (" You entered " + double_val +"\n"); } catch (InputMismatchException e) { System.out.println ("Mismatch exception:" + e ); } } // main } // class ScanConsoleApp ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1073472&group_id=44253 |