Read A File

3 comments - Post a comment

/***** Java Program to read a file and display it on the screen */

import java.io.*;
public class LioFile
{
public static void main(String args[])
{
try
{
FileReader fr=new FileReader("LioFile.java");
BufferedReader br=new BufferedReader(fr);
String str=" ";
String s1 =" ";
System.out.println(" s1 is "+s1.equals("ass"));

while((str=br.readLine())!=null)
{
System.out.println(str);
}
}
catch(FileNotFoundException fe)
{
fe.printStackTrace();
}
catch(IOException e)
{
e.printStackTrace();
}
}
}

/**** Output ***
s1 is false
import java.io.*;
public class J7
{
public static void main(String args[])
{
try
{
FileReader fr=new FileReader("J7.java");
BufferedReader br=new BufferedReader(fr);
String str=" ";
String s1 =" ";
System.out.println(" s1 is "+s1.equals("ass"));

while((str=br.readLine())!=null)
{
System.out.println(str);
}
}
catch(FileNotFoundException fe)
{
fe.printStackTrace();
}
catch(IOException e)
{
e.printStackTrace();
}


}
}
*/

 
This Post has 3 Comments Add your own!
siva477 - August 23, 2010 at 10:54 AM

what is the mean of "ass" in the program.

vizu - October 2, 2012 at 6:05 PM

Plz explain this program

vizu - October 2, 2012 at 6:12 PM

I didnt get this program

Post a Comment