
Hi,How can I get line and keep in a String in Java?

import java.io.*;
class ReadData
{
public static void main(String[] args) throws Exception
{
BufferedReader br=new BufferedReader(new FileReader("data.txt"));
String st;
while((st=br.readLine())!=null){
System.out.println(st);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
