Learn Java with
runnable examples.
Clear explanations, complete source code and sample output — from your first program to OOP, collections, threads and data structures.
223+
Programs
6
Tracks
21
Topics
JDK
Platform
Popular Programs
Default Access Specifier Example in Java
Java Access Specifiers regulate access to classes, fields and methods in Java.These Specifiers determine the scope of a method or variable or loop.
My First Java Example in Java
My First explained in Java, with a complete example program, its sample output, and a clear code walkthrough.
If Example in Java
A Java example program demonstrating If, complete with the source code and expected sample output.
Area of Circle Example in Java
The area of a circle is ? (Pi) times the Radius squared,which is written A=?r2. A Java example with source code and sample output.
Simple Array Example in Java
An array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key.
Simple Queue Example in Java
Simple Queue explained in Java, with a complete example program, its sample output, and a clear code walkthrough.
Celsius to Fahrenheit Example in Java
A Java example program demonstrating Celsius to Fahrenheit, complete with the source code and expected sample output.
Int Datatype Example in Java
Int Datatype in Java: a complete example program with source code and sample output, explained step by step.
Exception Handling Example in Java
Exception Handling explained in Java, with a complete example program, its sample output, and a clear code walkthrough.
Linked List Example in Java
This class stores the elements in nodes that each have a pointer to the previous and next nodes in the list. A Java example with source code and sample output.
Learning track
Java Basics
Start with your first Java program, data types, variables and operators — each topic includes runnable code and sample output.
Basic Programs
First programs, constructors, methods and simple class examples.
21 tutorialsData Type Programs
byte, short, int, long, float, double, char and boolean examples.
8 tutorialsVariable Programs
Local, instance and static variables with clear examples.
2 tutorialsOperator Programs
Arithmetic, relational, logical, assignment and increment/decrement operators.
20 tutorialsLearning track
Conditional
Control flow with if/else, switch, loops, jump statements and Java access specifiers.
Access Specifier Programs
public, private, protected and default access in Java classes.
4 tutorialsConditional Statement Programs
if, if-else, if-else-if, switch and ternary operator examples.
5 tutorialsLoop Programs
for, while, do-while, enhanced for and nested loop examples.
5 tutorialsJump Statement Programs
break, continue and return with practical examples.
2 tutorialsLearning track
Array and String
Work with arrays and strings — creation, traversal, manipulation and common utilities.
Learning track
OOPS
Object-oriented Java — inheritance, polymorphism, interfaces, exceptions, collections, threads and I/O.
OOPS Programs
Classes, objects, inheritance, polymorphism, encapsulation and abstraction.
10 tutorialsException Handling Programs
try-catch-finally, throw, throws, custom exceptions and common runtime errors.
19 tutorialsJava Collection Programs
ArrayList, HashMap, HashSet, TreeMap, Queue and related collection APIs.
23 tutorialsThread Programs
Thread creation, sleep, wait/notify and deadlock examples.
3 tutorialsJava Files And Input Output Programs
Readers, writers, streams and file handling in Java.
7 tutorialsLearning track
Miscellaneous
Patterns, conversions, calculations and assorted useful Java programs.
Miscellaneous Programs
Prime numbers, factorial, palindrome, GCD, LCM and more.
9 tutorialsPattern Programs
Triangles, Floyd's triangle, Pascal triangle and star patterns.
9 tutorialsConversion Programs
Temperature, case, string/array conversions and date formatting.
4 tutorialsCalculation Programs
Area, circumference, averages and numeric calculations.
27 tutorialsLearning track
Data Structure
Stacks, queues, linked lists, searching and sorting algorithms in Java.
Network
More learning sites
Explore tutorials on the main hub and dedicated language subdomains.