Results 1 to 2 of 2

Thread: Taking Input Stream

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    275

    Taking Input Stream

    I have to take Input Stream of string in console

    The obstacle is that System.in.read() takes integer value, so if I even convert it like
    var1 = System.in.read();
    var2=var1.toString();

    It will store the ascii value of the first letter converted into integer as a string. Whereas I needed my string to be be stored.

    I have tried several methods on it like converting it
    var1= System.in.read();
    var2=(String)(var1);

    and also used System.console().readline(); which takes string but it is throwing nullpointer exception. (I dont know why)

    If anyone knows other method please tell it to me so I can take string input.

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Taking Input Stream

    use the java.util.Scanner class
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width