Results 1 to 2 of 2
  1. #1
    elm101 is offline Member
    Join Date
    May 2011
    Rep Power

    Default 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:
    Java Code:
    Scanner aScan=new Scanner(;
    int aNum=4;
    char []aCharArray=new char[aNum];
    for(int i=0; i<4; i++){
    The only problem is there is no nextChar method for the scanner class.
    Any suggestions?

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Richmond, Virginia
    Blog Entries
    Rep Power


    You can read a token or a line and then loop through the string with charAt(...)

Similar Threads

  1. Simple question...I hope
    By marksey07 in forum New To Java
    Replies: 6
    Last Post: 01-07-2011, 06:40 PM
  2. Simple question Hopefully, Scanner/file
    By drucey in forum New To Java
    Replies: 23
    Last Post: 10-25-2010, 02:55 PM
  3. Simple string add or subtract using scanner
    By weezer562 in forum New To Java
    Replies: 12
    Last Post: 10-21-2010, 09:23 PM
  4. Scanner Issues (User Input: Very Simple)
    By carlodelmundo in forum New To Java
    Replies: 8
    Last Post: 10-31-2008, 03:44 AM
  5. Replies: 2
    Last Post: 06-02-2008, 11:24 PM

Posting Permissions

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