BufferedReader reader = new BufferedReader(new FileReader(strPath));
 String line;
 while ((line = reader.readLine()) != null) 
 { 
   
     out.println(line);
 }

My textfile is like:

Statement1
Statement2
Statement3

the output i get is:

Statement1Statement2Statment3

I need the output as it is..same as the text file...i have tried to identify the newline charc as \n or \r or \n\r and then compare it.

if(line.equals("\n")
out.println("\n")

ALSO tried

if(line.equals("")
out.println("\n")

Nothing seems to work...Please need help...i have tried using the read() for charac by charac and still i am not getting it :( :(

BufferedReader reader = new BufferedReader(new FileReader(strPath));
 String line;
 while ((line = reader.readLine()) != null) 
 { 
   
     System.out.println(line + "\n");
 }
BufferedReader reader = new BufferedReader(new FileReader(strPath));
 String line;
 while ((line = reader.readLine()) != null) 
 { 
   
     System.out.println(line + "\n");
 }

I am going to shoot myself, really.

I tried the above code like a million times myself before posting it here, only to get the same wrong format

literally banged my head on the wall, cause couldnt figure out what was wrong.

had a brainwave, what was missing was

out.println("<pre>")

I am really very sorry to have wasted your time, with this utter silly mistake for which i really wanna kill myself :( :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.