oop Java访问实例化的对象
我不知道如何访问从该对象实例化对象的类
为清晰起见,示例:
public class A {
B b;
int number = 5;
public A() {
b = new B();
}
}
public class B {
public B() {
System.out.println(/*code to get the value of number*/);
}
}
我不能把number
传递到B
这在java中可能吗
共 (0) 个答案