摘要:
String类型可以有两种方式创建; 1.构造方法: char[] chs = {'a','b','c'}; String s1 = new String(chs); 2.直接赋值: String s3 = "abc"; 两者的区别就是,使用构造方法创建的对象,值相同的话内存地址不同,而使用直接赋值 阅读全文
posted @ 2021-03-26 17:48
Sherlock_W
阅读(36)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2021-03-26 16:27
Sherlock_W
阅读(35)
评论(0)
推荐(0)
摘要:
创建一个类 public class Phone { //成员变量 String brand; int price; //成员方法 public void call(){ System.out.println("打电话"); } public void sendMessage(){ System.o 阅读全文
posted @ 2021-03-26 15:46
Sherlock_W
阅读(67)
评论(0)
推荐(0)