Results 1 to 3 of 3
- 04-17-2012, 01:31 AM #1
Member
- Join Date
- Apr 2012
- Posts
- 2
- Rep Power
- 0
-
Re: How do I print numbers in a line?
There are two printing methods that you'll commonly use:
System.out.println(someString): which prints a String and then a new-line, and
System.out.print(someString): which prints a String but no new-line. You can use this to print several things on one line.
Also, consider looking into using System.out.printf(...): which can be useful for printing formatted output. There are decent tutorials easily found on Google which will explain how this works.
- 04-17-2012, 08:08 AM #3
Member
- Join Date
- Apr 2012
- Posts
- 2
- Rep Power
- 0
Re: How do I print numbers in a line?
Thanks, that helped. I used the System.out.print() and got my output in a horizontal, which is what I wanted. Now I need to limit the number of characters to 7, then go to the next line. I have tried different things and have been able to stop at seven, continue on the next line, but each line after the first printed 8 characters (I did that once, about 2 hours ago, but can't remember how I did it. It had something to do with the '%' symbol). I'm a little frustrated and would appreciate any help.
Similar Threads
-
How to print palindromic numbers on the console!
By AlfieSDK in forum New To JavaReplies: 6Last Post: 05-21-2011, 02:24 AM -
Program - Print row of 5 even numbers, 5 rows, last num 50
By An Alien in forum New To JavaReplies: 10Last Post: 12-20-2010, 12:47 PM -
using backtracking to print all possible orders of numbers
By yotamoo in forum New To JavaReplies: 6Last Post: 12-08-2010, 12:39 AM -
print random numbers without repetition
By princess.blue in forum New To JavaReplies: 3Last Post: 02-04-2010, 09:37 AM -
how to multiply numbers in rows and print it next to it
By racewithferrari in forum New To JavaReplies: 1Last Post: 01-16-2010, 06:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks