java Interview Questions
basics
What is the difference between JDK, JRE, and JVM?
JDK (Java Development Kit) is a full-featured software development kit for Java, including the compiler and other tools. JRE (Java Runtime Environment) provides libraries, Java Virtual Machine (JVM), and other components to run Java applications. JVM is an abstract machine that executes Java bytecode.
What is a constructor in Java?
A constructor is a special method in Java used to initialize objects. It has the same name as the class and does not return any value. Constructors are called when an instance of the class is created and can be overloaded to provide multiple ways to initialize objects.
multithreading
What is multithreading in Java?
Multithreading in Java refers to concurrent execution of two or more threads. Java supports multithreading through the `Thread` class and `Runnable` interface, allowing multiple threads to run concurrently, improving performance for tasks like network operations, database queries, etc.
What is a thread in Java?
A thread in Java is a lightweight process. Each thread has its own call stack, and multiple threads can exist within the same program. Threads can be created by extending the `Thread` class or implementing the `Runnable` interface.
AI Mock Interview
Boost your confidence and skills with our AI-powered mock interviews.