Count the lines in file

//Count the lines in file
import java.io.*;
class Line
{
public static void main(String args[])throws IOException
{
int c,lcnt=1;
try
{
FileReader fr=new FileReader("Line.java");
while((c=fr.read())!=-1)
{
System.out.print((char)c);
if((char)c=='\n')
{
lcnt ++;
}
}fr.close();
System.out.println("no of lines io file"+lcnt);
}catch(Exception e)
{
System.out.println(e);
}
}
}
/*
D:\javapro\file>javac Line.java

D:\javapro\file>java Line
//Count the lines in file
import java.io.*;
class Line
{
        public static void main(String args[])throws IOException
        {
                int c,lcnt=1;
                try
                {
                        FileReader fr=new FileReader("Line.java");
                        while((c=fr.read())!=-1)
                        {
                                System.out.print((char)c);
                                if((char)c=='\n')
                                {
                                        lcnt ++;
                                }
                        }fr.close();
                System.out.println("no of lines io file"+lcnt);
                }catch(Exception e)
                {
                        System.out.println(e);
                }
        }
}
no of lines io file26
*/