Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How can I fix the spacing on my output?

  1. #1
    Junior Member
    Join Date
    Jun 2019
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default How can I fix the spacing on my output?

    I want my output to look like example1, but instead it looks like example2.
    Attached Images Attached Images

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,333
    Thanks
    53
    Thanked 2,393 Times in 2,347 Posts

    Default Re: How can I fix the spacing on my output?

    Use a format String with printf that gives you the desired results. See the API doc for the Formatter class for how to create a format String.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Line Spacing
    By Williamscn in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 22nd, 2014, 08:24 AM
  2. can someone fix my code to get the following output?
    By kmal47 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 8th, 2014, 04:50 AM
  3. Output is Wrong .How to fix it?
    By cmen535 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 5th, 2013, 01:15 AM
  4. [SOLVED] Extra spaces in output - why & how to fix?
    By KL1209 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: July 7th, 2012, 11:44 PM
  5. Help with formatting spacing on a calender grid please!
    By bulx0001 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: June 27th, 2011, 12:53 AM