Error using Buffered Reader
<p>I have written the following code to count number of lines,characters and words from a file.
I have used BufferedReader.</p>

<pre><code>import java.io.*;

class FileCount
 {


public static void main(String args[]) throws Exception
{
    FileInputStream file=new FileInputStream("sample.txt");
    BufferedReader br=new BufferedReader(new InputStreamReader(file));
    int i;
    int countw=0,countl=0,countc=0;
    do
    {
        i=file.read();
        if((char)i==("\t"))
            countw++;
        else if((char)i=="\n")
            countl++;
        else
            countc++;



    }while(i!=-1);
    System.out.println("Number of words"+countw);
    System.out.println("Number of lines"+countw);
    System.out.println("Number of characters"+countc);
}
}
</code></pre>

<p>The problem is that i have to only use buffered reader.I know we can not compare char and String which i have done in my code.
is there any other way out to this code?</p>
