System.out.format System.out.printf
System.out.format System.out.printf
public class TestFormat {
public static void main(String args[]) {
System.out.println(PI = + Math.PI);
System.out.printf (PI = %.2f %n, Math.PI);
System.out.format (PI = %.2f, Math.PI);
}
}
> java TestFormat
PI = 3.141592653589793
PI = 3.14
PI = 3.14
public static void main(String args[]) {
System.out.println(PI = + Math.PI);
System.out.printf (PI = %.2f %n, Math.PI);
System.out.format (PI = %.2f, Math.PI);
}
}
> java TestFormat
PI = 3.141592653589793
PI = 3.14
PI = 3.14
- ผู้มาเยือน
Re: System.out.format System.out.printf
d ʴŢҹԺ
f ʴŢȹ
o ʴŢҹỴ
e, E ʴŢԷʵ
x, X ʴŢҹԺˡ
s ʴ繢ͤ
t, T ˹ٻẺͧѹ
b, B ʴ繢Ẻ Boolean (true/false)
n ˹鹺÷Ѵ
c ʴ繵ѡ
f ʴŢȹ
o ʴŢҹỴ
e, E ʴŢԷʵ
x, X ʴŢҹԺˡ
s ʴ繢ͤ
t, T ˹ٻẺͧѹ
b, B ʴ繢Ẻ Boolean (true/false)
n ˹鹺÷Ѵ
c ʴ繵ѡ
- ผู้มาเยือน
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ