Menu

Question 7 Write Method Countlines String Filename Class Fileutility Reads Binary Byte Fil Q43785259

Question 7 Write a method countLines (String in Filename) of a class FileUtility which reads a binary byte file with name inF

Question 7 Write a method countLines (String in Filename) of a class FileUtility which reads a binary byte file with name inFilename using FileInputStream. The method returns the no. of lines containing comments starting with “//” with optional spaces (but not other characters) before it. Each line is terminated by ‘n’. You may write other methods if necessary. Handle possible exception by outputting a suitable message if an exception occurs. [5 marks] Show transcribed image text Question 7 Write a method countLines (String in Filename) of a class FileUtility which reads a binary byte file with name inFilename using FileInputStream. The method returns the no. of lines containing comments starting with “//” with optional spaces (but not other characters) before it. Each line is terminated by ‘n’. You may write other methods if necessary. Handle possible exception by outputting a suitable message if an exception occurs. [5 marks]

Expert Answer


Answer to Question 7 Write a method countLines (String in Filename) of a class FileUtility which reads a binary byte file with nam…

OR