63 052
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #33626 in Java | JSP | JSF for Ashan

Question #33626
To load a text-file, read it line by line, and return the
total number of alphanumeric tokens it contains and skip over the comments and double-quoted strings
in the text-file while you are processing it
Expert's answer
BufferedReader fin = new BufferedReader( new InputStreamReader(new FileInputStream("test.txt"),"windows-1251"));
List<String> fileContent = new ArrayList<String>() ;
String str ;
while( (str = fin.readLine() ) != null )
fileContent.add(str) ;
fin.close() ;


To skip over the comments and double-quoted strings


in the text-file while you are processing it, you should use class StringTokenizer

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions