They all execute at runtime. Some errors (syntactical) will be detected at compile time, others (semantic) will not, because they are legal Java even if they do not do what the programmer wishes.Originally posted by kranthi kumar.chamarthi:
...which statements will be executed at runtime and which at compile time simply by seeing the code
Originally posted by Campbell Ritchie:
Yes, there is a simple way to tell which statements execute at compile-time. None of them.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
Well, it's actually not that simple, as far as I know. If I'm not ways off, some constant expressions, such as
"This " + "text"
42*7
actually get "executed" at compile time - the byte code will only contain the value of the expression, not the expression itself.