In order to answer this question I first have to make sure you are aware of what an abstract class is. Here is how I was told to think about the concept of abstract classes when I was first learning how to program.
Lets say you are programming a zoo simulator, and because you like using good OOP class structure you decide to make some classes to represent your animals. So you make Lion, Tiger, and Bear classes (oh my) and realize that their code is reasonably the same. Therefore you decide to create an abstract animal class that can't be instantiated. Now the whole point of abstract classes is that you can't make a new instance of them like this:
Animal animal = new Animal();
You decide that this works for your simulator because you don't want to add general animals to your zoo, you want to add specific animals to your zoo and so an abstract class is the right idea. So the idea of abstract classes is: abstract classes are used when you want a general class that your specific classes extend.
Now in your scenario you did this:
GraphicObject o = null;
So why can we do this when we can't instantiate an abstract class? Because we didn't, when you set o
to null you aren't creating a new object, and therefore that is valid code. Finally on your line that looks like this:
o.meMethod3();
We can see that this is valid code, meaning that it compiles fine, however I bet if you were to run it you would get a NullPointerException
because you tried to do something to a variable that doesn't have a value.
So to sum up again: The reason behind the concept of abstract classes is that sometimes you want to write code that is going to be reused in a lot of other classes, but you don't want to create an instance of that class because it is supposed to be general.