一:基本数据类型转String
语法:将基本数据类型的值 + “ “即可
案例演示:
int n1 = 100;float n2 = 1.1fboolean b1 = true;String str1 = n1 + ""String str2 = n2 + ""System.out.println(str1);System.out.println(str2);
二:String类型转基本数据类型[包装类]
Integer.parseInt( "123");DoubLe.parseDouble( "123.1");FLoat. parseFloat("123.45");Short.parseShort(12");Long.parseLong( "12345");BooLean.parseBoolean( "true");Byte.parseByte( "12");
三:将字符串转成字符char->含义是指把字符串的第一个字符得到
s5.charAt(0) //得到s5字符创的第一个字符System.out.println(s5.charAt(0));
