@Bhanu: Please do not provide direct answers. Instead, provide hints, links to Javadocs, etc. JavaRanch is
NotACodeMill, and we encourage people to
DoYourOwnHomework. We'd rather teach people how to learn and think about programming than provide direct answers.
@Mahesh: If you're reading a file, how do you know you're at the end? The java.io.File API documentation might help you think of some ideas.
That aside, what are you trying to accomplish? What will you do once you're at the end?