Widely Used: Java is one of the most popular programming languages used by millions of developers worldwide.
Building Applications: Java is used in various applications, including mobile apps, web development, desktop applications, and large-scale enterprise systems.
Platform Independence: Java’s “Write Once, Run Anywhere” feature allows you to run your applications on any device with a Java Virtual Machine (JVM).
Strong Community Support: A large and active community provides extensive resources, libraries, and frameworks to help you learn and develop in Java.
Job Opportunities: Knowledge of Java can open up numerous job opportunities in various industries, as employers highly demand it.
Object-Oriented: Java’s object-oriented structure makes it easier to manage and maintain code by promoting modularity and reusability.
Security: Java provides robust security features that help in developing secure applications.
Rich API: Java offers a comprehensive set of APIs for almost everything, from networking to data structures, making development easier.
Strong Memory Management: Automatic garbage collection helps in managing memory efficiently, reducing the risk of memory leaks.
Scalability: Java is suitable for developing both small applications and large, complex systems due to its scalability and reliability.
Check out 1000+ Java API guides: Java API Documentation.
This tutorial covers everything about the Java programming language. It is designed for beginners and professionals who want to learn Java from scratch.
Java Basics
- Overview of Java
- History of Java
- Main Features of Java
- Setting Up the Java Environment
- Writing Your First Java Program
- Difference Between JDK, JRE, and JVM
- JVM and Its Internals
- Java Memory Management
- Java Variables
- Java Data Types
- Java Type Conversion
- Java Comments
- Java Operators
- Java Arithmetic Operators
- Java Assignment Operators
- Java Relational Operators
- Java Unary Operators
- Java Logical Operators
- Java Bitwise Operators
Control Flow Statements
- Java Control Flow Statements
- Java If Statement
- Java switch Statement
- Java while Loop
- Java do-while Loop
- Java for Loop
- Java for-each Loop
- Java break Statement
- Java continue Statement
- Java return Statement
Java Arrays and Strings
Java OOPs
- Introduction to Java OOP
- Java Classes and Objects
- Java Constructors
- Java Access Modifiers
- Java Encapsulation
- Java Inheritance
- Java Single Inheritance
- Java Multilevel Inheritance
- Java Hierarchical Inheritance
- Java Polymorphism
- Java Method Overloading
- Java Method Overriding
- Java Abstraction
- Java Abstract Class
- Java Interface
- Difference Between Interface and Abstract Class
- Java this Keyword
- Java super Keyword
- Java Nested Classes
- Java Packages
Java Misc
Java Exception Handling
- Java Exception Handling
- Java try-catch Block
- Java finally Block
- Java throw and throws Keywords
- Java Custom Exceptions
- Java Checked Exceptions
- Java Unchecked Exceptions
- The try-with-resources in Java
Java Collections Framework
- Introduction to Java Collections Framework
- Java Collection Interface
- Java List Interface
- Java ArrayList
- Java LinkedList
- Java Stack
- Java Vector
- Java Set Interface
- Java HashSet
- Java LinkedHashSet
- Java TreeSet
- Java Map Interface
- Java HashMap
- Java LinkedHashMap
- Java TreeMap
- Java Hashtable
- Java PriorityQueue
Java Multithreading
- Java Multithreading
- Java Thread Class
- Java Runnable Interface
- Java Thread Lifecycle
- Java Thread Synchronization
- Java Inter-Thread Communication
- Java ExecutorService
- Java Callable and Future
- Java Locks and Atomic Variables
Java Release-Wise Features
- Java 8 Features
- Java 9 Features
- Java 10 Features
- Java 11 Features
- Java 12 Features
- Java 13 Features
- Java 14 Features
- Java 15 Features
- Java 16 Features
- Java 17 Features
- Java 18 Features
- Java 19 Features
- Java 20 Features
- Java 21 Features
Guides on Java 8 Features
- Java Lambda Expressions
- Java Functional Interfaces
- Java Stream API
- Default and Static Methods in Interfaces
- Java Optional Class
- Java Date and Time API
Guides on Java 9 Features
Guides on Java 10 Features
- Java Local-Variable Type Inference (var keyword)
- List.copyOf() in Java
- Set.copyOf() in Java
- Map.copyOf() in Java
- Collectors.toUnmodifiableList() in Java
- Collectors.toUnmodifiableSet() in Java
- Collectors.toUnmodifiableMap() in Java
- Optional.orElseThrow() in Java
Guides on Java 11 Features
- Local-Variable Syntax for Lambda Parameters in Java
- Java HTTP Client
- Java HttpClient newHttpClient() Method
- Java HttpClient send() Method
- Java HttpClient sendAsync() Method
- Java 11 New String Methods
- Files.readString() and Files.writeString() in Java
Guides on Java 12 Features
Guides on Java 13 to 22 Features
- Java Records
- Switch Expressions in Java
- Helpful NullPointerExceptions in Java
- Text Blocks in Java
- Java 15 New String and CharSequence Methods
- Pattern Matching for instanceof in Java
- Java 16 New Stream Methods – toList(), mapMulti(), ofNullable()
- Sealed Classes in Java
- Stream.toList() Method in Java
- Code Snippets in Javadoc for Enhanced Documentation
Java API Documentation
Java Programs with Output
- Java Program to Reverse a String
- Java Program to Reverse a Number
- Java Program to Check Palindrome String
- Java Program to Check Armstrong Number
- Java Program to Find Prime Numbers
- Java Program for Prime Numbers Within a Range
- Java Program to Count the Number of Vowels in a String
- Java Program to Find the First Non-repeated Character in a String
- Java Program to Find Duplicate Characters in a String
- Java Program to Find Duplicate Words in a String
- Java Program to Find All the Permutations of a String
- Java Program to Count Occurrences of Words in a String
- Java Program to Count Vowels and Consonants in a String
- Java Program to Count the Number of Duplicate Words in a String
- Java Program to Count the Number of Occurrences of a Substring in a String
- Java Program to Count the Occurrences of Each Character in a String
- Java Program to Merge Two String Arrays
- Java Program to Remove Duplicate Words from a String
- Java Program to Reverse Each Word of a String
- Java Program to Swap Two Strings
- Java Program to Find Maximum Occurring Character in a String
- Java Program to Count the Occurrences of Each Character Using HashMap
- Java Program to Convert a String to Uppercase
- Java Program to Convert a String to Lowercase
- Java Program to Find the Longest Word in a String
- Java Program to Remove All Whitespace from a String
- Java Program to Check if a Number is Prime
- Java Program to Find the Fibonacci Series
- Java Program to Find the GCD of Two Numbers
- Java Program to Find the LCM of Two Numbers
- Java Program to Find the LCM of Two Numbers
- Java Program to Calculate the Power of a Number
- Java Program to Check if a Number is Even or Odd
- Java Program to Check Leap Year
- Java Program to Find the Sum of Digits of a Number
- Java Program to Find the Sum of Natural Numbers
- Java Program to Count the Number of Digits in a Number
- Java Program to Print Prime Numbers Between 1 and 100
- Java Program to Swap Two Numbers Without Using a Temporary Variable
- Java Program to Find the Largest of Three Numbers
- Java Program to Check if a Number is a Perfect Square
- Java Program to Convert Decimal to Binary
- Java Program to Convert Binary to Decimal
- Java Program to Find the Second Largest Number in an Array
- Java Program to Sort an Array Using Bubble Sort
- Java Program to Implement Binary Search in an Array
- Java Program to Implement Merge Sort
- Java Program to Implement Quick Sort
- Java Program to Find the Maximum and Minimum in an Array
- Java Program to Find the Sum of Elements in an Array
- Java Program to Remove Duplicates from an Array
- Java Program to Find the Frequency of Elements in an Array
- Java Program to Merge Two Arrays
- Java Program to Reverse an Array Without Using Another Array
- Java Program to Rotate an Array
- Java Program to Separate Even and Odd Numbers in an Array
- Java Program to Find the Median of an Array
- Java Program to Find the Intersection of Two Arrays
- Java Program to Find the Union of Two Arrays
- Java Program to Sort an Array of Strings
- Java Program to Reverse a Linked List
- Java Program to Find the Middle Element of a Linked List
- Java Program to Merge Two Sorted Linked Lists
- Java Program to Remove Duplicates from a Linked List
- Java Program to Find the Length of a Linked List
- Java Program to Delete a Node from a Linked List
- Java Program to Insert a Node at the Beginning of a Linked List
- Java Program to Insert a Node at the End of a Linked List
- Java Program to Check if a Linked List is a Palindrome
- Java Program to Implement a Stack Using Array
- Java Program to Implement a Stack Using Linked List
- Java Program to Implement a Queue Using Array
- Java Program to Implement a Queue Using Array
- Java Program to Implement a Queue Using Linked List
- Java Program to Implement Circular Queue
- Java Program to Implement a Priority Queue
- Java Program to Implement Circular Queue
- Java Program to Evaluate Postfix Expression Using Stack
Commonly Used Java Methods/APIs
Java Lang Package – Important Classes and its Methods/APIs
Class | Description |
---|---|
Java String Class Methods | Provides methods to manipulate and handle string data. |
Java Object Class Methods | Defines the root class of the Java class hierarchy. |
Java Integer Class Methods | Provides methods for converting int values and working with Integer objects. |
Java Double Class Methods | Provides methods for converting double values and working with Double objects. |
Java Long Class Methods | Provides methods for converting long values and working with Long objects. |
Java Boolean Class Methods | Provides methods for converting boolean values and working with Boolean objects. |
Java Character Class Methods | Provides methods for working with char values. |
Java Short Class Methods | Provides methods for converting short values and working with Short objects. |
Java Byte Class Methods | Provides methods for converting byte values and working with Byte objects. |
Java Class Methods | Provides methods for working with Java class objects. |
Java Thread Class Methods | Provides methods for managing and controlling threads. |
Java Math Class Methods | Provides methods for performing basic numeric operations. |
Java System Class Methods | Provides access to system-related resources and properties. |
Java Package Class Methods | Provides methods to get information about the implementation and specification of a package. |
Java ThreadLocal Class Methods | Provides thread-local variables. |
Java ThreadGroup Class Methods | Provides methods for managing groups of threads. |
Java Throwable Class Methods | Provides methods for handling exceptions and errors. |
Java Enum Class Methods | Provides methods for working with enum types. |
Java CompletableFuture Methods | Provides methods for asynchronous programming. |
Java Executors Class Methods | Provides factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory, and Callable classes. |
Java ThreadPoolExecutor Class Methods | Provides methods for managing a pool of threads. |
Java StringBuilder Methods | Provides methods for manipulating sequence of characters. |
Java StringTemplate Class Methods | Provides methods for template-based string operations. |
Java Util Package – Important Classes and it’s Methods/APIs
Class | Description |
---|---|
Java ArrayList Class Methods | Provides methods for managing dynamic arrays. |
Java HashMap Class Methods | Provides methods for managing hash tables and key-value pairs. |
Java Scanner Class Methods | Provides methods for parsing primitive types and strings using regular expressions. |
Java LinkedList Class Methods | Provides methods for managing linked lists. |
Java HashSet Class Methods | Provides methods for managing sets backed by a hash table. |
Java LinkedHashSet Class Methods | Provides methods for managing linked hash sets. |
Java CopyOnWriteArraySet Class Methods | Provides methods for managing thread-safe sets where elements cannot be changed once added. |
Java PriorityQueue Class Methods | Provides methods for managing priority queues. |
Java EnumSet Class Methods | Provides methods for managing sets of enum types. |
Java LinkedHashMap Class Methods | Provides methods for managing linked hash maps. |
Java TreeMap Class Methods | Provides methods for managing maps sorted according to the natural ordering of its keys. |
Java EnumMap Class Methods | Provides methods for managing specialized maps with enum keys. |
Java ConcurrentHashMap Class Methods | Provides methods for managing thread-safe hash tables. |
Java CopyOnWriteArrayList Class Methods | Provides methods for managing thread-safe lists where elements cannot be changed once added. |
Java Stack Class Methods | Provides methods for managing last-in-first-out (LIFO) stacks. |
Java Currency Class Methods | Provides methods for working with currency values. |
Java Objects Class Methods | Provides methods for working with objects and performing operations such as comparisons and null checks. |
Java Arrays Class Methods | Provides utility methods for manipulating arrays (such as sorting and searching). |
Java Collections Class Methods | Provides static methods that operate on or return collections. It includes methods for tasks such as sorting, searching, reversing, and synchronizing collections. |
Java Util Function Package – Important Classes and it’s Methods/APIs
Class | Description |
---|---|
Java Stream Methods | Provides methods for working with streams, allowing functional-style operations on sequences of elements. |
Java Collectors Class Methods | Provides implementations of reduction operations, such as accumulating elements into collections. |
Java IntStream Methods | Provides methods for working with streams of primitive int values. |
Java LongStream Methods | Provides methods for working with streams of primitive long values. |
Java DoubleStream Methods | Provides methods for working with streams of primitive double values. |
Java Time Package – Important Classes and it’s Methods/APIs
Class | Description |
---|---|
Java LocalDate Class Methods | Provides methods for working with dates (year, month, day) without a time-zone. |
Java LocalTime Class Methods | Provides methods for working with times (hour, minute, second, nanosecond) without a time-zone. |
Java LocalDateTime Class Methods | Provides methods for working with date-times without a time-zone. |
Java ZonedDateTime Class Methods | Provides methods for working with date-times with a time-zone. |
Java Instant Class Methods | Provides methods for working with a specific moment in time. |
Java Duration Class Methods | Provides methods for working with time-based amounts of time. |
Java Clock Class Methods | Provides methods for accessing the current instant, date, and time using a time-zone. |
List of All Java Keywords
Keyword | Description |
---|---|
byte | Used to declare a variable that can hold an 8-bit signed integer. |
short | Used to declare a variable that can hold a 16-bit signed integer. |
int | Used to declare a variable that can hold a 32-bit signed integer. |
long | Used to declare a variable that can hold a 64-bit signed integer. |
float | Used to declare a variable that can hold a 32-bit floating-point number. |
double | Used to declare a variable that can hold a 64-bit floating-point number. |
char | Used to declare a variable that can hold a single 16-bit Unicode character. |
boolean | Used to declare a variable that can hold a value of true or false. |
var | Used to declare a variable with inferred type (introduced in Java 10). |
if | Used to define a conditional statement or block. |
else | Used in conjunction with if to specify an alternative block of statements. |
for | Used to define a loop that executes a block of statements a specified number of times. |
while | Used to define a loop that continues to execute as long as its condition is true. |
do | Used to define a do-while loop, which executes a block of statements once before checking its condition. |
switch | Used to define a switch block that selects one of many possible blocks of code to execute. |
case | Used within a switch block to define a branch. |
break | Used to exit from a loop or switch block prematurely. |
continue | Used to skip the current iteration of a loop and proceed to the next iteration. |
default | Used in a switch block to specify the default case or to define default methods in interfaces (from Java 8). |
yield | Used in switch expressions to return a value (introduced in Java 13). |
class | Used to define a class in Java. |
new | Used to create new objects. |
static | Used to declare static members that belong to the class rather than any instance. |
interface | Used to define an interface. |
extends | Used to indicate that a class is inheriting from a superclass. |
implements | Used to implement an interface. |
super | Used to refer to superclass members. |
this | Used to refer to the current object. |
abstract | Used to declare abstract classes and methods. |
final | Used to declare constants and prevent inheritance. |
package | Used to define a package for the class. |
enum | Used to define a fixed set of constants. |
private | Used to declare private fields and methods. |
protected | Used to declare protected fields and methods. |
public | Used to declare public classes, fields, methods, and constructors. |
try | Used to define a block of code to be tested for exceptions. |
catch | Used to define a block of code to handle exceptions. |
finally | Used to define a block of code to be executed after a try block, regardless of whether an exception is thrown or not. |
throw | Used to explicitly throw an exception. |
throws | Used to declare the exceptions that a method can throw. |
synchronized | Used to declare synchronized blocks or methods to control the access of multiple threads to shared resources. |
volatile | Used to indicate that a variable’s value will be modified by different threads. |
module | Used to define a module (introduced in Java 9). |
exports | Used to export all public members of a package in a module. |
requires | Used to specify required libraries inside a module. |
open | Used to create an open module that grants reflective access to other modules. |
opens | Used to expose specific packages for reflective access by other modules. |
uses | Specifies the services consumed by the current module. |
provides | Specifies services provided by the current module. |
sealed | Used to define sealed classes and interfaces (introduced in Java 17). |
non-sealed | Used to define non-sealed classes and interfaces. |
permits | Used to specify the subclasses that can extend the sealed class directly. |
void | Indicates that a method does not return any value. |
return | Used to exit from a method and optionally return a value. |
transient | Used in serialization to indicate that a variable should not be serialized. |
strictfp | Ensures strict precision of floating-point calculations across different platforms. |
import | Used to import other Java packages or classes into the current file. |
instanceof | Used to test whether an object is an instance of a specific class or implements an interface. |
native | Specifies that a method is implemented in native code using JNI. |
record | Used to define a special type of class that acts as a data carrier (introduced in Java 14). |
assert | Used to make an assertion in debugging. |
const | Reserved but not used in Java. |
goto | Reserved but not used in Java. |
_ | From Java 9, _ (underscore) is a keyword and cannot be used as an identifier. |