package pack1;
public class A {
private int i;
float f;
public double d;
public float getF()
{
return f;
}
public void setF(float f)
{
this.f = f;
}
public double getD()
{
return d;
}
public void setD(double d)
{
this.d = d;
}
package pack1;
public class B {
public static void main(String[] args) {
A a=new A();
a.setF(2);
a.setD(3);
System.out.println("f="+a.getF()+" d="+a.getD());
}
}
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();
B b=new B();
b.f();
a.setD(3);
System.out.println("d="+a.getD());
}
}