The JDK comes with whole lot of API for writing awesome programs using Java. Java API’s have been categorized as per the functionality performed by them. The following tutorials have been organized by using the same set of categories.



IS-A and HAS-A relationship
The inheritance and composition relationship exists between real-world entities which are translated into entities in object oriented programming.

Uses-A and HAS-A relationship
Association and Composition are important OOPS relationships with only thin difference between the two. They are also known as uses-a and has-a relationships.

Static methods and Runtime Polymorphism
There is no concept of runtime polymorphism with static methods. When a static method is also defined in the sub class then it is results in method hiding.

OOPS SOLID Principles
The core object oriented programming principles based on which the various concepts like inheritance, encapsulation and polymorphism are based.

Inheritance among interfaces
An interface can inherit the constants and member methods from another interface in Java. This is allowed in order to make it easy to define unique entities.

Invoke constructors using this and super keywords
Constructor chaining can be implicit or explicit. Both the forms use this and super keywords to invoke one constructor from another.

Difference between abstract class and interface
Coding and Design level differences between Abstract classes and Interfaces in Java.When to use interface and Abstract class in your code.

Operator Overloading in Java?
Java doesn’t support overloading which is because of the complexity it brings. However there is still a notion of operator overloading.

Multiple Inheritance in Java
Java doesn’t support multiple inheritance but one can have multiple super types with the help of interfaces. Classes in Java don’t support multiple inheritance.

Co-variant return types
The co-variant return types are used for specifying a generic return type and actually returning a concrete return value. e.g. returning HashMap instead of Map.

Protected constructors in a class
The protected keyword is used to hide constructor from non-subclasses in other packages. See the code example for protected constructor.

Class Loaders

Class loading mechanism in Java
Steps performed by JVM for loading a class to memory. Code showing how class loading works.

this and super keywords
Understanding the use of this and super keywords in different situations in Java. static final, class level and method level final variables.

Purpose of methods in abstract class
What is the significance of methods present in an Abstract class. Some can be abstract methods while other can be concrete.Learn more here.

Various Java memory areas and their purpose
Various areas of memory used by JVM include heap and non-heap. Both these areas are further divided into categories including permgen, eden space and tenured etc

new operator and newInstance method
new operator and newInstance method are two different ways to create instances of a class. Difference between new operator and newInstance is asked in interview

JDK concepts

Difference between JVM, JRE, JDK and JIT
There are so many terms frequently used by developers. Some of them are known to everyone but here is a listing which describes the meaning of each one of them.

What are tag interfaces?
What are Marker interfaces. Are they obsolete. How to create custom marker interfaces. Example code for tag interfaces. Where is marker interfaces used in JDK.

main method working in Java program
main method working in Java. Valid versions of main method. arguments, return type and access specifier and requirement of main method.

Initialize final variables
final variables initialization tips. Constructor initialization in Java. Definitely initialized final variables. static final and method level final variables.

Performing cloning of objects
How to perform deep and shallow cloning in Java with sample code. Implications of Cloneable interface and CloneNotSupported Exception.

A Java quiz
Some Java questions which can be used for testing Java knowledge. Also good for Java interviews. Boost your confidence level.

JAR files shipped with JRE
A list of important jar files available in Java along with the purpose of each one of them. Good to know jar files in Java.

Using variable arguments in methods
Variable arguments is a nice feature where you can pass as many arguments as possible by using ellipses.

Working of system.out.println
The use of System.out.println is very common as it can be used to debug application code. Some suggestions on sysout in this article.

static methods and non-static data
Accessing non-static variables/methods from static fields is very common problem with Java code. See some scenario on how to fix it.

Using ocal, binary and hexadecimal values
Some practical use cases for using binary, octal and hexadecimal number systems in Java program. Real world usage of number systems in applications.

JAR, WAR and EAR files
Difference between JAR, WAR and EAR files. JAR tool in the bin folder of JDK can be used to create all three types of files which contain java class files.

Difference between POJO, JavaBean and EJB
Various differences between POJO, Java Bean and EJB classes. Properties that define the POJO are different than from Java Bean and EJB.

Instance initializer blocks
Instance initializer code block plays an important role and is different from constructors in java code. The code blocks are executed before any constructor.

== operator and equals method
How to compare to objects in Java using == operator and equals method. Tips for overriding the equals method in Java.

Difference between ANT and MAVEN
ANT and MAVEN both allow the project to be compiled, tested and deployed. However there are still many differences which one should be aware of.

Signing JAR files with certificate
Improve security of your applications by first checking the authenticity of JAR files using jarsigner tool. One can also create and add own certificate to JAR

final, finally and finalize
The difference between final, finally and finalize is frequently asked in java interviews. These are used in a lot of scenario and have different meanings.

Various access modifiers
The access specifiers like public, private, protected and default are used to manage the visibility of classes, methods and variables.

Bytecode for Java programs
Bytecode is an internal representation of the operations and operands used by JVM and is the basis of platform independence for java applications.

Setting PATH, CLASSPATH and JAVA_HOME is the first job which should be done when starting with development and writing code for Java applications.

Purpose of interfaces
Few reasons on why interfaces were added to Java language in the first place include resolution of diamond problem, marker interfaces etc.

5 most common CLASSPATH problems with solutions
There are a number of issues faced by developers regarding CLASSPATH. Here we have answers solution to 5 most common issues.

Inner Classes

What is double Brace initialization
Tutorial on what is double brace initialization and the working in a Java application. Sample code on how to use double brace initialization.


XML Handling

Remove invalid XML characters
How to handle the exception related to An invalid XML character (Unicode: ) was found in the CDATA section. Java code to fix the invalid xml characters.


Detect browser proxy settings from Java program
Sample code to detect the current proxy settings of machine using Java code. Various options by which proxy settings of multiple browsers can be found.


NullPointer exception handling
NullPointerException is very common in Java applications. If we handle null values effectively in code, we can avoid NullPointerException.

ClassNotFoundException and NoClassDefFoundError
One should never try to recover from NoClassDefFoundError but there are ways by which program can recover from ClassNotFoundException in Java program.

Checked and Unchecked exceptions in Java
Various differences between checked and un-checked exceptions in Java. Examples of code showing the use of checked and unchecked exceptions.

JDK 7 multi catch block
Automatic finally block added by try with resources and the use multi catch block to execute the same code for multiple exception handler.

Custom exceptions classes and their usage
A simple tutorial on how to create custom exception in a Java application and using it in required scenario.

Difference between Exception and Error
Difference between exception and error in java with the help of example code. Exception and Error have common super class but differ in behavior.

The finally block for exceptions
It is important to free any resources previously held after the code has made use of it. The finally block comes handy in this situation as it always executes.

Best Practices

Code review checklist for Java projects
A list of checks to be performed before signing off and delivering the code to production.Includes best code review practices followed by developers.

final variables and TDD
Final keyword freezes everything in a java application including classes,methods and variables. But it can be problematic in test cases as described here.

Best practices for code comments
Comments are an excellent way to improve the readability of the code. There are many type of comments suited for Java, HTML,CSS,JavaScript.

Class and Sequence UML diagrams
UML class and sequence diagrams depict the design of an application. While class diagram shows static data, sequence diagrams contains dynamic information.

Performing static analysis in Java projects
A list of features and plugins for static analysis. What is static analysis and their benefits.

Constructor and setter methods for classes
When to use constructors and setter methods for creating the objects of a class. Both provide a mechanism for providing a value for member instance variables.

Weak and Strong immutability in Java programs
Immutability is the behavior of not being able to change the object state. Weak and Strong Immutability is similar to shallow and deep cloning.

Best practices for naming variables, methods and classes
There are ways which can make the program more readable by adding better names for variables, methods and classes. There are useful naming conventions.

Avoid memory leaks in Java programs
Troubleshooting the issues faced in Java applications regarding memory leaks. Major reasons for getting out of memory errors and fixing them.


Create and Delete files and folders using Java I/O
Sample programs for dealing with folders and directories in Java. Creating and Deleting folders from filesystem using Java program can be done with File API.

Print files using Java code
Sample code for performing three tasks using the Java program viz. listing all printers, getting default printer name and send file for printing.


Timer and TimerTask classes
Tutorial on how to schedule tasks like Birthday emails in Java without the need of any third party library jar file.


Database connectivity in Java programs
Connecting to a database like Oracle,MySQL,DB2 or SQL Server and performing database operations from Java code.

Exception chaining in JDBC code
SQL exceptions have error code associated with them and when multiple errors have occurred in one SQL statement execution then these DB errors get chained.


Create custom collection classes
Inheritance of Java Collection classes to perform customization the behavior as per the requirement of the application. Improve default behavior.

Using Iterator in Java
The iterator design pattern hides complexity of underlying complex data structure like ArrayList,Set and provides convenience methods to get elements of structure.

Internal working of hashcode
Hashcode is used by hash based collections. The method to generate hashcode is present in Object class and is inherited by all.Tutorial on internals of hashcode

How to use Comparable interface
How compareTo method works and how to override it so as to perform object comparison in Java code.

Difference between Comparable and Comparator interfaces
A list of difference between Comparable and Comparator interfaces, both of which are used for object comparison.

Difference between HashMap and HashTable
List of differences between HashMap and Hashtable and when to use which one. History of hash based collections in Java.

Difference between TreeMap and TreeSet
How to perform natural sorting of elements in case of TreeMap and TreeSet collection in Java code. Internal working of TreeMap and TreeSet.

How to sort HashMap based on keys
5 ways in which sorting of elements of HashMap can be done. Native and third party library ways in which sorting can be done in Java code.

Difference between ArrayList and Vector
List of differences between ArrayList and Vector in Java. When to use ArrayList versus Vector in a Java application.

Using Comparator interface to compare objects
The use of Comparator interface for object comparison in Java application. Various techniques and best practices to follow when overriding compare method in Java

How to perform set based operations in Java
Tutorial on how to perform set theory operations on Java collection classes with the help of methods like addAll, contains and removeAll.

Big Oh complexity of collections
A list of Java collections classes and their complexity for Create,Read,Update,Delete (CRUD) operations in the Big Oh notation format.

What is hashcode and equals contract
Understanding the hashcode and equals method is important in order to write program which gives expected results and avoids any issues.

Interview questions on collections
A complete set of Java Collection interview questions and answers with links to detailed articles. Dominate Java interviews with confidence.

Difference between Hashtable, synchronizedMap and ConcurrentMap
Hashtable, Collections.synchronizedMap and ConcurrentHashMap are three ways by which one can add concurrency in a multthreaded applications with HashMap.

How to write hashcode method
Various ways by which hashcode can be generated. A well written hashcode method improves the performance of collection classes like HashMap, LinkedHashMap.

Working of HashMap and HashSet
The internal working of HashMap and HashSet uses hashcode for storing the keys and values. While HashMap has a number of value objects, HashSet has only one.

initialCapacity of Verctor and ArrayList
Using the initial capacity of vector or ArrayList classes to optimize the performance of application. In some applications, setting this attribute is crucial.

Difference between Iterator and ListIterator
Common and important difference between Iterator and ListIterator interfaces required for coding and interview perspective.

Multi Threading

Various Thread priority levels in Multi-Threaded applications
What are the various thread priorities levels in a Java applications. Using thread priority for creating and using the yield method in a java project.

Object level lock and Class level lock
Adding locking mechanism in code so that object level lock can block threads created from same instance and class level lock can block threads from same class.

Difference between wait/notify mechanism and synchronized keyword
wait, notify and notifyAll methods are used in Java for inter threaded communication and synchronized key word is used for mutually exclusive code.

Create new thread using Runnable interface and Thread class
There are two ways to create thread in Java including the use of Thread class and Runnable interface. Both can be used to create threads.

What is the use of Throwable class
Throwable is a special class in JDK which is the super class of exception hierarchy. It has been purposefully made a class instead of interface.

How to interrupt threads
Thread interruption is used to grab thread attention but it can raise InterruptedException if the thread is in blocked state.

Why wait/notify/notifyAll in Object class
ait,notify and notifyAll methods are used for thread communication. All these methods are present in the Object class and inherited by all classes in Java.

How daemon threads work in Java
Working of daemon threads by making a normal thread go in the background and perform some low priority job like garbage collection.

wait and sleep methods
Working of wait and sleep methods in Java with difference between the two methods in terms of usage and behavior when used in a java program.


Prevent access to private members using reflection
Access to block the private members of a class can be done by using multiple ways. One by changing the permission from the method and other by Security Manager.

Add .doc table of contents using Docx4J
Adding the table of contents filed in a Microsoft word document with extension docx. Java has docx4j which can do the job of adding TOC.


Why is String class immutable in Java
String class immutability in Java is because of the fact that it helps in fixing a lot of security, performance and concurrency issues.

Difference between StringBuilder and StringBuffer
4 differences between StringBuffer and StringBuilder which can be used to write optimized code. String is immutable but StringBuffer/StringBuilder are not.

Difference between CodePoint and CodeUnit
Code Points and Code Units are very much related to each other. Both of them are used to create an encoding system like UTF-8, UTF-16 or UTF-32.

Adding special characters in string object
Split String output and String literal characters by using the special character and + concatenation character respectively. See code for this.

Split strings using split method and StringTokenizer class
Tutorial on splitting Strings by using delimiter with the help of split method and StringTokenizer class.

How to override toString method in Java
Best practices for overriding toString method to get a string representation of the object at hand. See sample code for implementing the toString method.

Garbage Collection

Java garbage collection
Tutorial on how garbage collection works in a Java application. Can we force garbage collection. What algorithms are used by JVM for garbage collection.


Role of serialVersionUID in serialization
serialVersionUID is very frequently asked in Java interviews due to the importance it has in Serialization. When implementing serializable, it should be used.

Externalizable and Serializable interfaces
Serializable provides help in serializing the objects of a class and Externalizable interface helps in customizing it. More differences in this tutorial.

How to perform object serialization in Java
Sample code and working of Serializable interface in Java. How to perform serialization of objects in Java application with the help of working code.


Top 10 Core Java Books
Best Java book recommendation for Java developers (beginner, intermediate and advanced)