package ch07;
/**两种方法把类和对象写在同一个文件内
* Created by liwenj on 2017/7/20.
*/
//1
public class Cell {
String pp;
void cd() {
System.out.println("品牌是" + pp + "可以充电");
}
public static void main(String[] args) {
Cell PP = new Cell();
PP.pp = "华为";
PP.cd();
}
}
//2
public class Cell {
String pp;
void cd() {
System.out.println("品牌是" + pp + "可以充电");
}
}
class TestCell {
public static void main(String[] args) {
Cell PP = new Cell();
PP.pp = "华为";
PP.cd();
}
}