String.valueOf(Obj); String str = String.valueOf(Obj);
package com.java.myapp; public class MyClass { public static void main(String[] args) { double a = 12.345; boolean b = true; int c = 123; long d = 1232874; float e = 23.23f; char[] f = {'a', 'b', 'c', 'd' }; System.out.println("a = " + String.valueOf(a)); System.out.println("b = " + String.valueOf(b)); System.out.println("c = " + String.valueOf(c)); System.out.println("d = " + String.valueOf(d)); System.out.println("e = " + String.valueOf(e)); System.out.println("f = " + String.valueOf(f)); } }
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท