package pack1; public class Phone { //成员变量 String brand; int price; //成员方法 public void call(){ System.out.println("打电话"); } public void sendMessage(){ System.out.println("发短信"); } } package pack1; //测试类 public class PhoneDemo { public…
常用类 字符串相关的类 String类:代表字符串,使用一对 "" 引起来表示. public final class String implements java.io.Serializable, Comparable<String>, CharSequence { /** The value is used for character storage. */ private final char value[]; /** Cache the hash code for…