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}