Java questions

Jun 26, 2020 | - views

Explain JDK, JRE and JVM?
What is the difference between equals() and == in Java?

Equals() method is defined in Object class in Java and used for checking equality of two objects defined by business logic.

“==” or equality operator in Java is a binary operator provided by Java programming language and used to compare primitives and objects. public boolean equals(Object o) is the method provided by the Object class. The default implementation uses == operator to compare two objects. For example: method can be overridden like String class. equals() method is used to compare the values of two objects.

What are the differences between Heap and Stack Memory in Java?
Feature Stack Heap
Memory Stack memory is used only by one thread of execution. Heap memory is used by all the parts of the application.
Access Stack memory can’t be accessed by other threads. Objects stored in the heap are globally accessible.
Memory Management Follows LIFO manner to free memory. Memory management is based on the generation associated with each object.
Lifetime Exists until the end of execution of the thread. Heap memory lives from the start till the end of application execution.
Usage Stack memory only contains local primitive and reference variables to objects in heap space. Whenever an object is created, it’s always stored in the Heap space.
What are access modifiers in Java?
What is final keyword in Java?
What is exception hierarchy in java?
What are the differences between processes and threads?
Difference between String, StringBuilder, and StringBuffer.
Describe Java IO Streams
What is a classloader in Java?

The Java ClassLoader is a subset of JVM (Java Virtual Machine) that is responsible for loading the class files. Whenever a Java program is executed it is first loaded by the classloader. Java provides three built-in classloaders:

  1. Bootstrap ClassLoader
  2. Extension ClassLoader
  3. System/Application ClassLoader
Describe Generics Naming convention
What is the life-cycle of a servlet?
Name the different modules of the Spring framework.
Describe key JDBC interfaces.
Explain Hibernate architecture.
Explain Spring Annotations.