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 3 of 3

Thread: I'm relatively new to programming and suck at printf() please help me understand

  1. #1
    Junior Member
    Join Date
    Oct 2018
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question I'm relatively new to programming and suck at printf() please help me understand

    this is what I have but when I run it I get a
    java.util.FormatFlagsConversionMismatchException

    System.out.printf("%0s%11s%22s%33s%44s%55s%66s",
    "Town","Date","Temp","Direction","Wind Speed","Wind Chill","Reporter");

  2. #2
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default Re: I'm relatively new to programming and suck at printf() please help me understand

    The problem is the 0 width on the first field. Also, the number is the width of that particular field. So your entire line would have a width of the sum of all those numbers. They are not tab locations.

    Regards,
    Jim

  3. #3
    Junior Member
    Join Date
    Oct 2018
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I'm relatively new to programming and suck at printf() please help me understand

    thank you so much, it's all looking good now you're a life saver

Similar Threads

  1. Replies: 1
    Last Post: April 6th, 2014, 02:49 AM
  2. [SOLVED] Need help with printf
    By Elyril in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 24th, 2014, 03:40 PM
  3. Formatting using Printf()
    By Dtank123456 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 8th, 2014, 03:48 PM
  4. [SOLVED] printf error
    By Thor in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 10th, 2012, 10:05 PM
  5. Replies: 0
    Last Post: December 12th, 2011, 03:17 PM

Tags for this Thread