摘要: 前面说到引用数据类型的存储方式与基本数据类型不一致,这里做进一步更规范的说明。 先看代码: 1 public class String01 { 2 public static void main(String[] args) 3 { 4 String str1 = "yyds"; 5 String 阅读全文
posted @ 2021-01-25 16:22 EvanTheBoy 阅读(78) 评论(0) 推荐(0)
摘要: 1 public class String01 { 2 public static void main(String[] args) 3 { 4 String str1 = new String("ZJU"); 5 System.out.println(str1.indexOf('J')); //也 阅读全文
posted @ 2021-01-25 11:40 EvanTheBoy 阅读(47) 评论(0) 推荐(0)
摘要: 创建一个String类的对象str1,调用一些方法,看看效果: 1 public class String01 { 2 public static void main(String[] args) 3 { 4 String str1 = new String("ZJU"); 5 System.out 阅读全文
posted @ 2021-01-25 11:37 EvanTheBoy 阅读(40) 评论(0) 推荐(0)
摘要: java中的字符串: 字符串常量:要用双引号引起来(英文双引号):例如:"2333","dalao","orz"等等。若要换行,可以在中间加转义字符。例如:"yy\nds". 字符串变量:这里需要用到一个类,叫做String类。可像下面这样定义: 1 String str = "tql"; 2 // 阅读全文
posted @ 2021-01-25 11:27 EvanTheBoy 阅读(67) 评论(0) 推荐(0)