Hello all again,
In order to run the program we have to first compile it successfully right?

This is the setup needed to compile the above 2 file. I had already told what to do. I repeat it again.
1.You can
test this concept in any directory.
2. You have to crate 2 files namely (case sensitive)
Point.java and PlusPoint.java 3. cut and paste the above program
including the package statement in their correspoining files. You all must have known this because in
Java in 1 single source file there can be maximum 1 public class file and the file MUST BE named after the public class which is inside the source file.
4. Now you have 2 .java files Point.java and PlusPoint.java in your current directory with all the correct code inside them
5. Compile
javac -d . Point.java 6. Compile
javac -d . PlusPoint.java 7. There SHOULD NOT be any problem in compilation because the
-d . option creates the needed sub directories for the compilation unit.
8. Now after compilation there would have been 2 sub-directories created under your current dir where you did the compilation. They are
points and morepoints. Inside the points dir, the Point.class would have been created and simillarly inside morepoints directory PlusPoint.class would have been created.
So now you have the simillar dir structure.
<pre>
c:\test\Point.java
c:\test\PlusPoint.java
c:\test\points\Point.class
c:\test\morepoints\PlusPoint.class
</pre>
--------------------------------------------------------------
Coming back to our original discussion, here
1. we have 2 completely different packages
points and
morepoints. 2. The Point.class belongs to ONLY points package
3. The PlusPoint.class belongs to ONLY morepoints package
4. The Point class has a method called move(...) which has the
default or in other
word the
package level access.Which means this class Point is well known to all the other classes
inside the same package 'points'. Also note that though the class Point is available to the
whole world , still the method move(..) inside Point.java says,
'I have my own wishes. It is me who takes the decision. If you as a class can be public. I don't bother' like that.
5. Since Point.class gives free access to all

by means of
public access keyword, eventhough it is kept inside 'points' package, it CAN BE extended or used in other packages also.
6. This public access of Point.class gives freedom to the other unrelated class 'PlusPoint.class' in unrelated package 'morepoints' to extend it.
7. The important point here to note is as I said before, eventhough
points.Point.class is public points.Point.move(..) method is
not granted here 
. So the
morepoints.PlusPoint.class decides to write on its own version of move(...) method. When can you override a method? If it is inherited from the super class only right? When the super class version is NOT EVEN KNOWN to the subclass (since superclass move belongs to its own pack ), how can it override? If the programmer decides to separate the 2 files in different packages then he has to overcome the consequences.
8. So the PlusPonint's move method is its own version of fresh-born new method. It can have any type of access level . (private/protected/public). There is NO-CONNECTION bet the super class version and the subclass version here.
9. Also note that the 'moveAlso(..)' method is granted to PlusPoint.class because it has public access level. So when u call movealso(..) from PlusPoint.class, it is executed, and you know what? ..

it, calls the parent version of the move which is in Point.class NOT IN PlusPoint.class. Because the origianl inherited version of movealso called the move(..) version which is inside its package and since it is not overridden here in PlusPoint.class the super version is called.
10. ALso
if you would have in fact changed the access level of the Point class move to public and if you would have overridden now in PlusPoint.class , and when u call moveAlso(..) , now the overridden version would have been called , which leads to moveAlso(..) calls move(...) which again calls moveAlso(...) which again calls move... leads to StackOverflow at run time

regds
maha anna
[This message has been edited by maha anna (edited April 18, 2000).]