java进阶 package包29

package com.cyjt97.a;
public class studer {
public static void main(String[] args) {
cf();
}
private static void cf() {
System.out.println("吃饭");
}
}
package com.cyjt97.b;
public class studer {
public static void main(String[] args) {
seel();
}
private static void seel() {
System.out.println("睡觉");
}
}
package com.cyjt97.test;
import com.cyjt97.a.studer;
public class t {
public static void main(String[] args) {
studer stu1 = new studer();
// 导包类名相同时,用权类名创建对象
// 包名+类名
com.cyjt97.b.studer stu2 = new com.cyjt97.b.studer();
}
}
代码改变了我们,也改变了世界

浙公网安备 33010602011771号