Java: Exemple d’utilisation de printf

Author:


{filelink=6019}


public class PrintfMots {
  public static void main(String[] args) {

    String [] mots = new String [] { "x", "sakoba", "abcdefghijklmnopqrstvuwxyz" };
    System.out.printf( "%-10s %sn", "mot", "Longuer" );
    for ( String mot : mots )
      System.out.printf( "%-10.10s %sn", mot, mot.length() );

  }

}
/*
mot        Longuer
x          1
sakoba     6
abcdefghij 26
*/

A Voir sur le même Sujet:

  • exemple d'affichage printf java
  • souligner un string dans un printf
  • telecharger printf
  • exemple printf en java
  • utiliser printf androis
  • java printf et date
  • exemple de printf en java
  • java printf couleurs
  • java printf
  • java "%g" printf

Leave a Reply

Your email address will not be published. Required fields are marked *