need help in how to print new line character in unix using java

Hi All,

I use the printstream class to print some line in a text using java.

here is the code:

FileOutputStream out;// declare a file output object

PrintStream p;// declare a print stream object

p.print("\t");

p.print(date);

p.print("\t\t");

p.print(RecCount);

p.println("\n");

when i use this and output of this character in windows is

dateRecCount

22-07-200723456

when i use the same code in unix it shows the following output:

date RecCount[]22-07-2007

it wont accept the new line character could any one give me an idea to solve this problem.

[785 byte] By [sebas.navina] at [2007-11-27 11:20:49]
# 1

PrintStream has a println() method. Use that. Or System.getProperty("line.separator").

Because a newline char doesn't necessarily specify a line break. It's system-dependent.

CeciNEstPasUnProgrammeura at 2007-7-29 14:44:52 > top of Java-index,Java Essentials,Java Programming...
# 2

By the way, get rid of those comments. They're both wrong (you declare references, not objects) and useless (everybody sees that you're declaring a reference).

CeciNEstPasUnProgrammeura at 2007-7-29 14:44:52 > top of Java-index,Java Essentials,Java Programming...