package com_black.daobao.A1; public class Teacher { public void teach(){ System.out.println("good study,day day up"); } } package com_black.daobao.A2; import com_black.daobao.A1.Teacher; public class Demo { public static void main(String[] args) { /*com_black.daobao.A1.Teacher t=new com_black.daobao.A1.Teacher(); t.teach(); com_black.daobao.A1.Teacher t2=new com_black.daobao.A1.Teacher(); t2.teach(); */ //如果在上方输入import+包名 例如:import com_black.daobao.A1.Teacher; 则后面可以直接输入 Teacher t=new Teacher(); t.teach(); } }
标签:daobao,修饰符,A1,导包,black,teach,权限,com,Teacher From: https://www.cnblogs.com/hxh-/p/17694871.html