Java important differences everyone must know

This tutorial will help to read about Java important differences everyone must know. Based on my prior experience, this gets asked most of the time in interviews, irrespective of the number of years.

Comparable vs Comparator

Iterator vs ListIterator

throw vs throws

ArrayList vs Vector

Abstract class and interface

HashMap vs Hashtable

equals() vs ==

Final, finally and finalize


It is a java keyword used as a non-access modifier with Classes, attributes and methods.

After making class as final will not allow us to inherit the class.

Method as final will not allow us override in child class.

Making any variable as final will not allow us to override the value.


Finally block is used to execute for closing an open connections.


  1. finally will always get call either exception is thrown or not.
  2. finally block can be used either with catch or finally.
  3. finally block can be used with or without catch block.


Every time an object is garbage collected, the finalize() method is called.

We can request the garbage collector to run using the System.gc() method.

List, Map and Set

List: List allows duplicate values. It allows multiple null values. It maintain insertion order.

Set: Set doesn’t allow duplicate value. Set allows only one null value. It doesn’t maintain any insertion order. Set elements can be iterate using keyset() and entryset()

Map: Map allows only one null key and multiple null values. Map maintain insertion order. Element need to convert into set to iterate.

Imran Khan

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan