PrintfExamples.java Source code

Java tutorial

Introduction

Here is the source code for PrintfExamples.java

Source

public class PrintfExamples {
    public static void main(String[] args) {
        System.out.printf("sci not num is %e\n", 3.14159265 * 10000);
        System.out.printf("sci not num is %g\n", 3.14159265 * 10000);
        System.out.printf("sci not num is %e\n", 0.123456789);
        System.out.printf("sci not num is %g\n", 0.123456789);
        System.out.printf("sci not num is %e\n", 3000000.0);
        System.out.printf("hex num is %h\n", 1.0);
        System.out.printf("num is %h\n", 0xCAFE);
    }

}
/*
sci not num is 3.141593e+04
sci not num is 31415.9
sci not num is 1.234568e-01
sci not num is 0.123457
sci not num is 3.000000e+06
hex num is 3ff00000
num is cafe
    
 */