I want to print column names, below is my code
for ( int k=1 ; k< columnCount+1;k++){
System.out.println(columnNames[k] + " ");
}
How do I print the values as columns?
I want
value 1 value 2 value 3
not
value1
value2
value3
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Simplest way is to use
lninprintlnmeans that you want to add new line mark at the end of printed line.Also as Reimeus pointed in his comment you can use tabulator
"\t"instead of fixed number of spaces.But IMHO since you are using it to print columns you should use
System.out.format(orSystem.out.printf) to print fixed amount of characters likeMore info in Formatter class documentation.