JDK
JDK (Java Development Kit) is a software development environment that provides tools and libraries necessary for developing Java applications.
It includes the:
1. compiler,
2. debugger,
4. and other development utilities.
JRE
JVM
Explain the concept of polymorphism in Java
For Example:
class Shape {
void draw() {
System.out.println("Drawing a shape");
}
}
class Circle extends Shape {
@Override
void draw() {
System.out.println("Drawing a circle");
}
}
class Rectangle extends Shape {
@Override
void draw() {
System.out.println("Drawing a rectangle");
}
}
public class Main {
public static void main(String[] args) {
Shape circle = new Circle();
Shape rectangle = new Rectangle();
circle.draw(); // Output: Drawing a circle
rectangle.draw(); // Output: Drawing a rectangle
}
}What are the different types of collections available in Java?
List
Set
Map
Queue
Follows the FIFO (First-In-First-Out) principle.
Explain the concept of generics in Java
What are the benefits of Generics?
ArrayList
ArrayList is the List implemented for a resizable array.
LinkedList
Sequential access (walking the list) is better than random access.
When should you use an ArrayList?
When should you use LinkedLists?
Explain the concept of threads in Java
What is synchronization in Java?
Ensures that only one thread can access a shared resource at a time.
Serialization
Deserialization
byte code -> object
How do you serialize and desserialize a class?
What are annotations in Java?
Annotations provide metadata about program elements, such as:
1. classes,
2. methods,
3. or fields.
From Java 8 How do you handle dates and times in Java?
for handling dates, times, and time zones.
What are the advantadges of the Date and Time API in Java 8?
What are lambda expressions in Java?