View Single Post
  #2 (permalink)  
Old 01-12-2008, 07:59 AM
CaptainMorgan's Avatar
CaptainMorgan CaptainMorgan is offline
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Well first, there is no nextString() method within the Scanner or String classes. So I would suggest:
Code:
String name; DataInputStream in = new DataInputStream(System.in); System.out.print("Enter your name :"); try { name = in.readLine(); } catch (Exception e) { e.printStackTrace(); }
And that should take care of reading your string inputs. As far as icNo, I'm unclear whether you wish to retrieve a string from the input, or whether icNo is really supposed to be declared as an int(which it's not). If you want it to return an int, declare as one instead of a string. If it's really supposed to be a string - follow the method above for now, but find a better way as readLine() is deprecated.

See how that works for you...
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)

Last edited by CaptainMorgan : 01-12-2008 at 08:05 AM.
Reply With Quote