int a = 15; System.out.printf( "%d %x", a, a );
int a = 15; System.out.printf( "%d %X", a, a );
int a = 15; System.out.printf( "%d %#x", a, a );
int a = 15; System.out.printf( "%d %o", a, a );
System.out.printf( "%.1f", 100./3. );
System.out.printf( "%.1e", 100./3. );
System.out.printf( "%S", "Test" );
System.out.println( "s=" + 2 + 3 );
System.out.println( "s=" + (2 + 3) );
System.out.println( "p=" + 2 * 3 );
System.out.printf( format, 123456 );
printf("%n");einen Zeilenumbruch erzeugen. Ist das besser als
printf("\n");
System.out.printf( "%d", 2.2 );
System.out.printf( "%d", i, j );
System.out.printf( "%d %d %d", i, j );
System.out.printf( "%d %<x %<o", 15 );
System.out.printf( "%2$d %3$d %1$d", 2, 4, 6 );
System.out.printf( "%2$s %s %s %s", "a", "b", "c", "d" );
System.out.printf( "%.1f", 3.3 );ergibt die Ausgabe 3,3, Was erwarten Sie bei
System.out.printf( Locale.US, "%.1f ", 3.3 );
System.out.printf( "%ta %<td. %<tb %<tY", Calendar.getInstance());
double x = 10./3.; System.out.printf( "%.1f %.2f ", x, x ); // mit Dezimalkomma angeben
convertertmp | Dec 02, 18:49 |
Jun 18, 09:15 | |
atest/erben | May 02, 10:37 |
atest/oop2 | Apr 18, 10:30 |
thm/Studium | Mar 30, 11:58 |
atest/oop1 | Mar 30, 11:57 |