1class A {
2
3 public void a1 ( ) {
4 }
5
6 private void a2 ( ) {
7 }
8}
9
10class B {
11
12 private A objA = new A ( );
13
14 public void b1 ( ) {
15 // Call to method a1. This works.
16 objA.a1 ();
17 }
18
19 void b2 ( ) {
20 // Call to method a2. This will give compile error.
21 objA.a2 ();
22 }
23}
1public class Alpha {
2 public void DoSomethingAlpha() {
3 Beta cbeta = new Beta();
4 cbeta.DoSomethingBeta(); //?
5 }
6}
7
1public class Alpha extends Beta{
2 public void DoSomethingAlpha() {
3 DoSomethingBeta(); //?
4 }
5}
6