package pack1; public class A { private int i; float f; public double d; }
package pack1; public class B { public static void main(String[] args) { A a = new A(); a.f=2; a.d=3; } }
package pack2; public class B { public void f() { System.out.println("执行pack2包中的类B的方法f"); } }
package pack2; import pack1.A; public class C { public static void main(String[] args) { A a = new A(); a.d=3; B b = new B(); } }
时间: 2024-10-26 16:38:52