Vinay Kejriwal wrote:Thanks Luan,
But shouldn't this code fail at compile time? I have seen this kind of code getting compiled without any error. So what exactly would be the behavior. Will jvm simply ignore this at runtime?
Welcome =) About the new questions:
>shouldn't this code fail at compile time? I have seen this kind of code getting compiled without any error. So what exactly would be the behavior. Will jvm simply ignore this at runtime?
The code will not fail in compile time due there isn't this kind of evaluation during this process from the Javac process perspective. Maybe a good
IDE may point this as a warning to make you aware that you might not get the desired behavior. The problem about the compile time, the Javac will just see if you have the correct syntax (liek keywords and their order to put in a nutshell) and the dependencies (to make the references inside the .class file). The real "magic" happens in the application server, which the container
thread analyze your deployment package and create some proxies and/or aspects to provide the services described in
Java EE specification. So, the container may also display some message of warn/error, depeding if it obligation d(if described in Java EE specification or not).
Best regards