4 Java questions please help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • normbrc
    New Member
    • Nov 2007
    • 2

    #1

    4 Java questions please help

    1) Implement (i.e., write the body of) the following method, countLines, that, given a BufferedReader parameter, counts and returns the number of lines of text in the corresponding file/stream.

    public static int countLines(Buff eredReader in) throws IOException
    _______________ _______________ _______________ _______________ __

    2) Implement a new version of the countLines method that catches the possible IOException exception and outputs an error message if such an exception is raised.

    public static int countLines(Buff eredReader in)
    _______________ _______________ _______________ _______________ __

    3) Implement the following method, sumLines, that, given a BufferedReader parameter, reads all the integer values appearing one per line in the corresponding file/stream and returns the sum of the integers. Make sure you catch and handle the possible IOException exceptions.

    public static int sumLines(Buffer edReader in)

    _______________ _______________ _______________ _______________ __

    4) Implement the following void method, copyFile, that, given a BufferedReader parameter and a PrintWriter parameter, copies the file/stream from the given BufferedReader to the file/stream of the given PrintWriter. Make sure you catch and handle the possible IOException exceptions.

    public static void copyFile(Buffer edReader in, PrintWriter out)
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    #2
    We can't write your code for you. Please try to start the problem and let us know where you have issues.

    Comment

    Working...