Hi,
I want to insert a new line in a text file which I generate from my code.
Following is the code snippet. Please see the output below. Why spaces are also coming between every character
/*****/
import java.io.*;
public class LetterGeneration
{
public static void main(
String[] args)
{
try
{
DataOutputStream fout = new DataOutputStream(new BufferedOutputStream (new FileOutputStream("Lines.Txt")));
fout.writeChars("This is first line");
fout.writeChars("This is second line");
fout.close();
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception occured..");
}
}
}
/*****/
Output : Lines.Txt
T h i s i s f i r s t l i n e T h i s i s s e c o n d l i n e
/******/
I want like this..
This is first line
This is second line
Thanks in advance..
Dhiraj