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: Exception in thread "main" java.util.IllegalFormatWidthException: 13

Threaded View

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Exception in thread "main" java.util.IllegalFormatWidthException: 13

    Hello every1,
    Im starting to self learn java from a book, now im in the middle of an exercise and i got this line "Exception in thread "main" java.util.IllegalFormatWidthException: 13" in the run window, working with netbeans 6.5.1 and this is the code:

     public class Functions {
        public static int power (int base, int n) {
        int result=1;
     
        for (int i=1 ; i<=n ; ++i)
            result = result * base;
                    return result;
     
        }
        public static void main(String[] args) {
            int res1, res2;
            System.out.printf("%-4s %-13s %-13n", "i", "power(2,i)", "power(3,i)");
            System.out.printf("%-4s %-13s %-13s%n", "-", "--------", "--------");
            for (int i=0; i<10; ++i) {
                res1 = power(2,i);
                res2 = power(3,i);
                System.out.printf("%-4d %-13d %-13d%n", i, res1, res2);
            }
     
        }
    }

    can any1 plz show me the problem ?

    Thank you very much !!
    Last edited by JavaPF; June 4th, 2009 at 10:10 AM. Reason: Please use [code] [/code] tags


Similar Threads

  1. Replies: 16
    Last Post: August 27th, 2010, 03:30 PM
  2. Replies: 3
    Last Post: April 20th, 2009, 08:35 AM
  3. [SOLVED] "GridLayout" problem in Java program
    By antitru5t in forum AWT / Java Swing
    Replies: 3
    Last Post: April 16th, 2009, 10:26 AM
  4. Books and tutorials for beginners in Java and Visual Basic
    By Professor Spider in forum The Cafe
    Replies: 5
    Last Post: April 9th, 2009, 10:57 AM