public class PrintfExamples {
public static void main(String[] args) {
// num is 3.141593
System.out.printf("num is %f\n", Math.PI );
// num is 3.14
System.out.printf("num is %.2f\n", Math.PI );
}
}
/*
num is 3.141593
num is 3.14
*/