background preloader

Java interview

Facebook Twitter

Jvm - Real differences between "java -server" and "java -client"? Just-in-time compilation - Wikipedia. Applications[edit] A common implementation of JIT compilation is to first have AOT compilation to bytecode (virtual machine code), known as bytecode compilation, and then have JIT compilation to machine code (dynamic compilation), rather than interpretation of the bytecode.

Just-in-time compilation - Wikipedia

This improves the runtime performance compared to interpretation, at the cost of lag due to compilation. JIT compilers translate continuously, as with interpreters, but caching of compiled code minimizes lag on future execution of the same code during a given run. Since only part of the program is compiled, there is significantly less lag than if the entire program were compiled prior to execution.

Overview[edit] In a bytecode-compiled system, source code is translated to an intermediate representation known as bytecode. In contrast, a traditional interpreted virtual machine will simply interpret the bytecode, generally with much lower performance. JIT code generally offers far better performance than interpreters. Just-in-time compilation. Is Java cross platform? Java bytecode - Wikipedia. Java bytecode is the instruction set of the Java virtual machine (JVM).

Java bytecode - Wikipedia

Relation to Java[edit] Instruction set architecture[edit] The JVM is both a stack machine and a register machine. Each frame for a method call has an "operand stack" and an array of "local variables".[2]:2.6 The operand stack is used for operands to computations and for receiving the return value of a called method, while local variables serve the same purpose as registers and are also used to pass method arguments.

The maximum size of the operand stack and local variable array, computed by the compiler, is part of the attributes of each method.[2]:4.7.3 Each can be independently sized from 0 to 65535 values, where each value is 32 bits. long and double types, which are 64 bits, take up two consecutive local variables[2]:2.6.1 (which need not be 64-bit aligned in the local variables array) or one value in the operand stack (but are counted as two units in the depth of the stack).[2]:2.6.2 Instruction set[edit] Java - What is the difference between JVM, JDK, JRE & OpenJDK? Java Classloader - Wikipedia. When the JVM is started, three class loaders are used:[3][4] Bootstrap class loaderExtensions class loaderSystem class loader The bootstrap class loader loads the core Java libraries[5] located in the <JAVA_HOME>/jre/lib directory.

Java Classloader - Wikipedia

This class loader, which is part of the core JVM, is written in native code. The extensions class loader loads the code in the extensions directories (<JAVA_HOME>/jre/lib/ext,[6] or any other directory specified by the java.ext.dirs system property). It is implemented by the sun.misc.Launcher$ExtClassLoader class. User-defined class loaders[edit] The Java class loader is written in Java.

This makes it possible (for example): to load or unload classes at runtime (for example to load libraries dynamically at runtime, even from an HTTP resource). Class Loaders in Java EE[edit] JAR hell[edit] JAR hell is a term similar to DLL hell used to describe all the various ways in which the classloading process can end up not working.[9] Three ways JAR hell can occur are: