End of File Indicator

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • feda
    New Member
    • Mar 2008
    • 11

    End of File Indicator

    Hello everybody
    I want the end of file indicator in Java
    I used the ctrl +Z but it seems not working ?!!
    this is the code:

    while (input.hasNext( ))
    {
    grade=input.nex tInt();
    total=total+gra de;
    gradeCounter=gr adeCounter+1;
    incrementLetter GradeCounter(gr ade);
    }
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    #2
    Originally posted by feda
    Hello everybody
    I want the end of file indicator in Java
    I used the ctrl +Z but it seems not working ?!!
    this is the code:

    while (input.hasNext( ))
    {
    grade=input.nex tInt();
    total=total+gra de;
    gradeCounter=gr adeCounter+1;
    incrementLetter GradeCounter(gr ade);
    }
    Maybe you need this...

    About the value assignments,

    You can simplify it like this,

    total += grade;
    gradeCounter++;

    It is a good practice... ;-)

    Sukatoa...

    Comment

    Working...