Results 1 to 2 of 2
Thread: Simple Scanner Question (i hope)
- 07-09-2011, 12:10 AM #1
Member
- Join Date
- May 2011
- Posts
- 5
- Rep Power
- 0
Simple Scanner Question (i hope)
Is there any way to scan in the next character from an input line.
I want to be able to do something like this:
The only problem is there is no nextChar method for the scanner class.Java Code:Scanner aScan=new Scanner(System.in); int aNum=4; char []aCharArray=new char[aNum]; for(int i=0; i<4; i++){ aCharArray[i]=aScan.nextChar(); }
Any suggestions?
- 07-09-2011, 12:24 AM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
You can read a token or a line and then loop through the string with charAt(...)
Similar Threads
-
Simple question...I hope
By marksey07 in forum New To JavaReplies: 6Last Post: 01-07-2011, 05:40 PM -
Simple question Hopefully, Scanner/file
By drucey in forum New To JavaReplies: 23Last Post: 10-25-2010, 01:55 PM -
Simple string add or subtract using scanner
By weezer562 in forum New To JavaReplies: 12Last Post: 10-21-2010, 08:23 PM -
Scanner Issues (User Input: Very Simple)
By carlodelmundo in forum New To JavaReplies: 8Last Post: 10-31-2008, 02:44 AM -
[SOLVED] Simple Scanner Method - Plus Sign throwing me off...
By Josh.Hoekstra in forum New To JavaReplies: 2Last Post: 06-02-2008, 10:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks