Re: Console input question -- how to wait for Enter key?

From: Hal Rosser (hmrosser_at_bellsouth.net)
Date: 12/10/04

  • Next message: Doug Lowe: "Re: Console input question -- how to wait for Enter key?"
    Date: Fri, 10 Dec 2004 15:18:13 -0500
    
    

    "Doug Lowe" <Doug-anti@spam-LoweWriter.com> wrote in message
    news:4%iud.547511$D%.281264@attbi_s51...
    > In Java 1.5, what's the easiest way to get a console java app to stop
    until
    > the user presses the Enter key?
    >
    > I want to do something like this:
    >
    > Scanner sc = new Scanner(System.in);
    > String answer;
    > ...
    > System.out.print("Press Enter to continue...");
    > answer = sc.next();
    >
    > But unfortunately the Scanner class makes you actually enter something, it
    > doesn't accept an empty string.
    >
    > Any help would be appreciated! TIA
    >
    >
    here's an example
    http://leepoint.net/notes-java/41io/15console/10console.html

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.807 / Virus Database: 549 - Release Date: 12/7/2004
    

  • Next message: Doug Lowe: "Re: Console input question -- how to wait for Enter key?"