Read Notepad Contents using Java
import java.io.*;
public class ReadNotepad
{
public static void main(String[] args)
{
try
{
FileInputStream fstream = new FileInputStream("C:\\Sample.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null)
{
}
System.out.println("Notepad Contents---->>>>"+strLine);
in.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
public class ReadNotepad
{
public static void main(String[] args)
{
try
{
FileInputStream fstream = new FileInputStream("C:\\Sample.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null)
{
}
System.out.println("Notepad Contents---->>>>"+strLine);
in.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
Comments
Post a Comment