Core Java Interview Ques
Core Java Interview Ques
& Tricky
INTERVIEW
Questions
Mostly Asked CORE JAVA
Interview – Questions
1) What is the difference between JDK, JRE, and JVM?
•JDK (Java Development Kit) is a software development kit that includes tools for developing and compiling
Java applications.
•JRE (Java Runtime Environment) provides the necessary runtime environment to execute Java applications.
•JVM (Java Virtual Machine) is a virtual machine responsible for running Java bytecode on a specific
platform.
1.Primitive Data Types: Java includes primitive data types (such as int, double, boolean) that are not objects. These
types are not part of any class hierarchy and are not treated as objects like other user-defined classes.
2.Static Members: Java allows the use of static variables and methods, which are associated with the class rather than
individual objects. Static members are not tied to specific instances of the class and, therefore, do not fully adhere to the
principles of OOP.
3.Procedural Programming: Java supports procedural programming as well. While Java encourages the use of classes
and objects, it also allows developers to write procedural-style code using static methods and procedural constructs.
4.Primitive Wrapper Classes: Java provides wrapper classes (e.g., Integer, Double) to represent primitive data types as
objects. These wrapper classes are used to convert primitive types to objects and vice versa, blurring the line between
object-oriented and non-object-oriented programming.
5.String: In Java, strings are objects of the String class, but they have some special treatment due to their frequent usage
and importance in programming.
Mostly Asked CORE JAVA
Interview – Questions
4) Why is the main method static?
Because the object is not required to call the static method. If we make the main method non-static, JVM
will have to create its object first and then call main() method which will lead to the extra memory
allocation.