• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What Other Class Can be used.....

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

What other class in package java.util can be used to read input from a user
apart from Scanner?
 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Here is something that a google search turned up - http://abbeyworkshop.com/howto/java/readLine/index.html

However, it uses java.io and not java.util .. It'd be better if you tell us what exactly are you trying to do ?
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a beginner's question:
Several possibilities just off the top of my head:
  • An InputStream can read directly, but one byte at a time. System.in is the most commonly used example.
  • A FileReader, often wrapped in a BufferedReader.
  • A StreamReader, often passed an InputStream and then wrapped in a BufferedReader.
  • Many Swing components, where you put text into a box. A very popular example for a non-GUI application is JOptionPane.showInputDialog().

  • But you will usually find Scanner easier to use where it is available.

    [edit]Formatting problem with the list corrected[/edit]
    [ December 14, 2007: Message edited by: Campbell Ritchie ]
     
    reply
      Bookmark Topic Watch Topic
    • New Topic