: ))) I can. : )))))) The same thing. It's easy, just that it's written on that way. Could be written differentlly, but this is , like , 'reduced', 'reduction'.
One part which might be confusing, is that what goes out on a consola, with a System.out.println, is a text similar, and simple as well, like the name of the classes and the name of the methods, which are void, or static, the other part is that all is called A A b B a b ... So, when the "trick" happens, it could be even more mysteriouse.
But practically, it's about counting, like counting
cards.
So, in a main method, that's like this part of the car which starts when you click the key (i don't know nothing about cars)
there are four 'CALLS' , one after another
(that's important, that they are one after another)
and on the screen, there is a .. four outputs.
- As it can be observed, in the whole program, there is, here , nothing more, but printing out to the screen.
And every method has only one printout.
So, what is needed, is to see which method printed what.
There is: FOUR CALLS
and : FOUR OUTPUTS
The Question IS: Which 'CALL', in a source code, corresponeds to an actuall method??
Four - out - of - four .
Pair the calls and methods!
ANd, then there ther is, void methods are ectually (default) voids... and might be overriden, and static void methods, are actually (default) static methods, which arent overriden, but redefined.
To my eyes it was missing public all around instead of (default), i consider it as a part of the "trick".
And this was, by my opinion, a nice code to confuse youre self, and then resolve confusement. But when you 'reduce' the 'reduced' version,
you should see that overriden methods don't behave the same like redefined methods, all in context of polymorphism and I don't know what, becaouse static methods are called diferentlly than instance methods. In instance methods, when in source code stays that there is a 'CALL', during the 'exectution time', when frankenstein lives, which method will really be called, is chosing a JVM..... by some rules. So, if there is a static method what's this about... then the -> type of the reference variable ______ like Animal a = new Dog(), Animal static method will be called....... While, if it's about an ordinary instance method... then... if Dog overriden the same Animal method, althou it is a Animal reference variable a, the actual 'real' object is Dog, and if Dog overriden, then the Dog method is called, instance method... Without it, it might be that the instance thing would be questionable.. So the question was.... Why.. if a subclass 'overrides' a superclasses STATIC method, and 'overriden' version isn't called?? (More or less).. Becaouse it is not 'overriden', but it is 'redefined'...
And code shows which is which.
Now you choose a card, and I'll tell you which one you chosed.