Hi Mohamed, I think the progran will work like below.
When u create an object of Extension in bogo method,
1. it will first call constructor of Extension() 2. Which in turn call super() constructor i.e Base constructor 3. Base constructor will call add(1) method. But Acoording to java run time system it will call the method of runtime object which is Extension so it will call add method of Extension which return value of i=2 4.Then control transfer to Extesion class and call add(2) method which leds value i=6 5. After that b.add(8) method will call which will return value i=22.