Sitemap

Member-only story

Java + Spring Boot + Microservices Interview Questions with Examples

6 min read2 days ago

🔹 Section 1: Core Java (10 Questions)

  1. What is the difference between == and .equals() in Java?
String a = new String("test");
String b = new String("test");
System.out.println(a == b); // false (reference comparison)
System.out.println(a.equals(b)); // true (value comparison)

== compares references; .equals() compares values (unless overridden).

2. What is the difference between HashMap and Hashtable?

  • HashMap is not synchronized (faster, not thread-safe)
  • Hashtable is synchronized (thread-safe, but slower)

3. What is the purpose of the final, finally, and finalize()?

  • final: Prevent modification
  • finally: Always executes after try-catch
  • finalize(): Called by GC before object removal

4. What is the difference between abstract class and interface?

abstract class Animal {
abstract void makeSound();
}

interface Walkable {
void walk();
}

Abstract class can have constructors and state; interface is contract only.

5. What are functional interfaces and give an example?

@FunctionalInterface
interface Greeting {
void sayHello(String name);
}
Java Interview
Java Interview

Written by Java Interview

Experienced Java Developer with 9 years of expertise in building scalable, high-performance applications. Adept at leveraging modern frameworks.

No responses yet