Prime b

Prime b

  • NA
  • 810
  • 345.6k

Read every othe chat in the file

Feb 21 2012 11:12 AM
Prompt the user for and store the file name (usernamesandpasswords.txt) of the attached file. On a new line for each, display back to the user every other character in the file name starting with the first character (u).

What i have done

  while (inputFile.hasNext())
        {
            line = inputFile.nextLine();


            for (int index = 0; index < line.length(); index+=2)
            {
                if (line.charAt(index) == character)
                {
                    System.out.println(line.charAt(index));
                }
            }



It doesnt work though

Answers (3)