reading a character


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: reading a character

  1. #1
    Join Date
    Jan 2005
    Posts
    3

    reading a character

    Hi there,
    I can't figure out how to read one character from standard input. I need to test this character with a switch statement.
    Thank you for any help.

  2. #2
    Join Date
    Jan 2005
    Posts
    45
    Hi,

    You may try something like this :

    int b = 0;
    try
    {b = System.in.read();}

    catch (Exception e)
    {...}
    System.out.println(" You typed:" + (char) b);


    Regards,
    Lionel Badiou
    CodeFutures -
    Java Code Generation

    http://www.codefutures.com



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center