aspose file tools*
The moose likes Beginning Java and the fly likes printing with reserved spaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "printing with reserved spaces" Watch "printing with reserved spaces" New topic
Author

printing with reserved spaces

Margaret Tan
Greenhorn

Joined: Sep 14, 2001
Posts: 20
Hi there,
I'm writing a program that prints the first 10 times table but the format it is printing in the dos prompt is really ugly, I want to make it aligned, how do I do that? I know in C, I can't remember it exactly but I was pretty sure that it uses like %3.2f to reserve 3 spaces for float, not sure what it was for integers. My question is what is the syntax to reserve spaces in Java using the System.out.println(). Thanks a bunch!
Margaret
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9053
    
  12
There is no equivalent in java. Here is a link to an alternative. Or you can use the NumberFormat or DecimalFormat class.
[This message has been edited by Marilyn deQueiroz (edited October 07, 2001).]


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: printing with reserved spaces