Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion scanner String console input question
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Stephen Edwards  
View profile  
 More options Mar 30 2012, 11:30 am
From: Stephen Edwards <edwa...@cs.vt.edu>
Date: Fri, 30 Mar 2012 11:30:26 -0400
Local: Fri, Mar 30 2012 11:30 am
Subject: Re: [BlueJ Discuss] scanner String console input question
On 3/30/12 10:45 AM, Davin McCall wrote:
> Assuming you want to enforce line-by-line input, you should use

 > nextLine() to get a full line and parse the returned String

This is a good idea.  Note that it is really easy to create a
new Scanner for a string, so you can still use the scanner's
features (instead of going to parseInt() and the like) if you
prefer.  Just one one scanner connected to your input channel to
read input line by line, and create a second scanner for each
line you wish to "carve up" individually.

-- Steve

---------------------------------------------------------------------------
Virginia Tech, CS Dept.     Web-CAT: Web-based Center for Software Testing
114 McBryde Hall (0106)     Automatic grading using student-written tests
Blacksburg, VA 24061 USA    http://web-cat.org/
(540)-231-5723              http://people.cs.vt.edu/~edwards/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.