在我写完代码之前已有人发贴了,我就用代码表达下吧- class A
- {
- void show()
- {
- System.out.println("a");
- }
- }
- class B
- {
- void show()
- {
- System.out.println("b");
- }
- }
- public class C
- {
- private A a = new A();
- private B b = new B();
-
- public void show()
- {
- a.show();
- b.show();
- }
- public static void main(String[] args)
- {
- C c = new C();
- c.show();
-
- }
- }
复制代码 |