How can i print rows 1 by 1 using System.out.println?
What i mean is I have the method
Code :
public static void dumpData(PrintStream ps, Data data)
which prints the results in seperate lines. I need to call this method dumpData(System.out, data) but each line should be in a row in a table. Is that achievable outside the method dumpData?
Re: How can i print rows 1 by 1 using System.out.println?
Quote:
which prints the results in seperate lines.
Data goes on a new line when you output a newline character. You can keep all the output on one line by NOT outputting a newline character until you want the next output to go to the next line.
The println() method always adds a newline character to the end of the data being printed.
The print() method does NOT add a newline character.
You can manually control where a newline character is added by using "\n" in the data.
Re: How can i print rows 1 by 1 using System.out.println?
Quote:
Originally Posted by
Norm
Data goes on a new line when you output a newline character. You can keep all the output on one line by NOT outputting a newline character until you want the next output to go to the next line.
The println() method always adds a newline character to the end of the data being printed.
The print() method does NOT add a newline character.
You can manually control where a newline character is added by using "\n" in the data.
I think that there isn`t a solution to my problem. Thanks anyway. I should find a different approach.