Esempi Java - formattazione di stringhe
L'esempio seguente mostra dal formato () per stringa di formato, è possibile anche specificare l'area di formattare ():
//StringFormat.java 文件 import java.util.*; public class StringFormat{ public static void main(String[] args){ double e = Math.E; System.out.format("%f%n", e); System.out.format(Locale.GERMANY, "%-10.4f%n%n", e); //指定本地为德国(GERMANY) } }
L'uscita è esempi di codice di cui sopra:
2.718282 2,7183