We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Java Output Formatting
Java Output Formatting
Sort by
recency
|
1467 Discussions
|
Please Login in order to post a comment
need to start learning format :(
import java.util.Scanner;
public class Solution {
}
it’s amazing how widely it’s used. Its “write once, run anywhere” capability really makes it stand out for developers. bet in exchange login
import java.util.Scanner;
public class Solution {
}
Java output formatting
function used- printf
%s - string formatting
%d - integer formatting
%15s - 15 void space from right Java______________
%-15s - 15 void space from left _______________Java
%03d - for 3digits =100, for 3 - 003, for 34 - 034
so to print formatted output System.out.printf("%-15s%03d\n",s1,x);
This is a great exercise for learning how to control output formatting in Java. cbtfturbo 247