Java String.valueOf() Java toString() 方法 Java测试字符串是否包含特定单词 Java String.valueOf() public class Sample { public static void main(String args[]){ int i = 200; float f = 12.0f; char c = 's'; char[] ch = {'h', 'e', 'l', 'l', 'o'}; String data = String.valueOf(i); System.out.println(String.valueOf(i)); System.out.println(String.valueOf(f)); System.out.println(String.valueOf(c)); System.out.println(String.valueOf(ch)); } } Java toString() 方法 Java测试字符串是否包含特定单词