Java Interview Questions
Java Interview Questions
Java is not a "PURE" Object Oriented Language , because it uses primitive data types such as
(int,float,char...etc). The developers of java could have made these primitive data types as
objects(like String... etc), but the primitive data types such as int float... are more faster than objects!
Java is not completely Platform Independent. The javac compiler first compiles the High-Level
program code written by the programmer, and byte code is formed. This byte code is platform-
independent but requires a Just In Time (JIT) interpreter/compiler.
The Java Runtime Environment, or JRE, is a software layer that runs on top of a
computer’s operating system software and provides the class libraries and other
resources that a specific Java program needs to run.
4. What is JVM?
JVM(Java Virtual Machine) acts as a run-time engine to run Java applications. JVM is the one that actually calls
the main method present in a java code. JVM is a part of JRE(Java Runtime Environment).
Java applications are called WORA (Write Once Run Anywhere). This means a programmer can develop Java
code on one system and can expect it to run on any other Java-enabled system without any adjustment. This is
all possible because of JVM.
When we compile a .java file, .class files(contains byte-code) with the same class names present in .java file are
generated by the Java compiler. This .class file goes into various steps when we run it. These steps together
describe the whole JVM.
5. Difference between Heap and Stack Memory in java. And how java utilizes this .
When we write a java program then all the variables, methods, etc
are stored in the stack memory.
And when we create any object in the java program then that
object was created in the heap memory. And it was referenced
from the stack memory.
6. How is Java different from C++?
C++ allows users to use pointers in the program. Whereas java doesn’t
allow it. Java internally uses pointers.
It is used for the security of the private properties of an object and hence
serves the purpose of data hiding.
8.