When I try to format my text by adding n width
i.e System.out.printf("%*c", n, ' ');
with n being the number of spaces, ' ' being the blank space char.
I get the error:
Exception in thread "main" ava.util.UnknownFormatConversionExceptio... Conversion = '*'
Java printf problem, System.out.printf("%*c", n, ' '); doesn't work?
there is no in build method like "printf" in Java. so if you Reilly wants to use it , then you have to write definition for the
printf() method explicitly.
Reply:The problem is printf. This is not a java method.
You should be using System.out.print() or System.out.println().
See the link below for the tutorial on how to use formatting.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment