本帖最后由 harborbest 于 2013-4-25 08:29 编辑
- import java.awt.Button;
- public class A {
- private Button b ;
-
- public Button getB() {
- return b;
- }
- public void setB(Button b) {
- this.b = b;
- }
-
- A(){
- b = new Button();
- B b = new B(this);
- }
- public static void main(String[] args){
- new A();
- }
- }
- class B {
- A past = new A();
- B(A p){
- this.past = p;
- }
- }
复制代码 为什么这段代码会报堆栈溢出的错误! |