I was thinking about it and I feel there is a strange loophole in the
Java language. By definition, an interface is a strictly flat structure with absolutely no executable code(apart from constants). Hence, method calls should not be allowed, and should have no executable code.
But if you consider the bad design below
You are actually calling the constructor from the interface. What is more weird is that you could add runtime variables at that time, and even change the structure of the object.
I know the code sample is a very poor design, but I thought java would address these issues to make it foolproof. Furthermore, if we do
we face the dreaded diamond inheritance problem which was so dreaded in C++
Java doesnt let you compile the code, but I thought interface rules were brought to avoid such problems in the first place.