Abimaran Kugathasan wrote:
The Output : High
I think logically what Abimaran saying is correct. But ..
Lets assume, above code is not correct. There may be two error
1. Compile time Error
2. Runtime Exception (something like method not found)
Lets think about each for them one by one -
1. Compile time error, I don't think it make sense because it is perfectly valid to call private method of a class from same class's static method.
2. Runtime Exception, how would you explain this behavior, compiler said it is ok code, then suddenly at run time code starting to throw method not found exception.
So my guess is since there is not perfect solution for this problem, best approach would be what is current behavior of Java. I think that's why java designer went for this approach.