File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Formatting Java

 
Shae Weathers
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need help formatting an assignment. The instructions were to create a program that would write a name 100 times. The program outputs the information vertically, but I need it to output it horizontally. Can anyone help me with this matter?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure--what do you have so far? Have you checked the Javadocs for the various print methods? (Hint: some print a new line after the string you pass in, some don't.)

And welcome to JavaRanch!
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12015
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you be more specific? I'm not sure I understand what you mean by 'horizontally' vs 'vertically'.

My guess is you should look at the difference between

System.out.print();

and

System.out.println();
 
Shae Weathers
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies, shortly after I posted the question I realized it was a matter of removing "ln" from the system.out.print statement.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would have been nice to follow up shortly after posting the question, then, so people wouldn't keep answering it!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic