Jeanne Boyarsky wrote:Because interfaces automatically define anything to be public. For data, they are also static and final. For methods, just public.
Ansh Sharma wrote:Hi Gautam ,
Many Thanks for the reply .
My doubt remains the same . Why can't we use the abstract class and have two abstract methods startFly() and calculateWeight()
instead of having Interface . For Example if tomorrow we find out some common behaviour between the classes (which in your case of Aeroplane and Mosquito might never happen ) we can have that concrete implementation in the abstract class .
Which design model of OOP is supported through this .. ?
Jeff Verdegan wrote:A language doesn't have an inherent property of being compiled or interpreted. Any language could be executed either way. (Or at least most languages. There may be some subtle detail that prevents it being universal).
In normal usage, Java source code is definitely compiled to Java bytecode--the machine code for the JVM. But then at runtime, that compiled bytecode is interpreted, at least at first, by the JVM. Some of the bytecode will be compiled to native code on the fly.
In the end, trying to classify Java as a "compiled langauge" or "interpreted language" is an oversimplification, and pointless.
.(see overview section)
The JIT compiler reads the bytecodes in many sections (or in full, rarely) and compiles them dynamically into machine language so the program can run faster. Java performs runtime checks on various sections of the code and this is the reason the entire code is not compiled at once. This can be done per-file, per-function or even on any arbitrary code fragment; the code can be compiled when it is about to be executed (hence the name "just-in-time"), and then cached and reused later without needing to be recompiled.Just-in-time_compilation