Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Méthode printf: Exemple de ‘%g,%e,% et %h’


{filelink=6032}

public class PrintfExamples {
  public static void main(String[] args) {
    System.out.printf("sci not num is %e
", 3.14159265*10000 );
    System.out.printf("sci not num is %g
", 3.14159265*10000 );
    System.out.printf("sci not num is %e
", 0.123456789 );
    System.out.printf("sci not num is %g
", 0.123456789 );
    System.out.printf("sci not num is %e
", 3000000.0 );
    System.out.printf("hex num is %h
", 1.0 );
    System.out.printf("num is %h
", 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
 
 */

A Voir sur le même Sujet:

  • %g exemple
  • methode printf java
  • printf "%h"
  • formatage des sorites des nombres java
  • printf
  • perl date du jour printf
  • printf méthode c++
  • code source pour save tableau en java swing
  • méthode printf en c++
  • controle decimale float %en python