i need a sample code for this
if text file is not empty then string s = first line of text of the text file.
please help me out.
ok not a homework question i am not looking for the solution just point me to the correct reference material.
i need a sample code for this
if text file is not empty then string s = first line of text of the text file.
please help me out.
ok not a homework question i am not looking for the solution just point me to the correct reference material.
This sounds like homework, do the following and ask about specific problems.
Some hints (because this smells homework and I'm not going to do it for you): decorate a FileReader with a BufferedReader and check BufferedReader#readLine().
The sun java tutorials have examples and explanations for tasks like this.
The IO Tutorial has a section in the File I/O section called Reading, Writing and Creating Files which looks like what you are looking for