This discussion is archived
2 Replies Latest reply: Nov 21, 2012 11:02 AM by SabareeshDivakaran RSS

Reading data from input File from columns

975553 Newbie
Currently Being Moderated
I've this data in the input file

CISC115.59     A
MANG100.01      B
COMP107.59      D
MATH140.59      C
MUSIC101.59      F

I want to read only the first column and store it in variable courseName. This is the statement i'm using to achieve this.

courseName = inputFile.next();

And i've also tried courseName=inputFile.nextLine();

But i'm unable to read just the data in first column(which is the course name) instead it is reading the data in both columns (i.e. course name and grade)

How can i only read the course name and not the grade next to it.?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points