创建接口 public interface ITest{ String name = "jianghao"; } 创建测试类 public calss TestA(){ public static void main(String[] args){ TestAImpl a = new TestAImpl(); System.out.println(a.name); System.out.println(ITest.name); } } 继承接口 public calss TestAImpl implements ITest{ }