Search...
Java Course Java Arrays Java Strings Java OOPs Java Collection Java 8 Tutorial Jav
Java Tutorial
Last Updated : 19 May, 2025
Java is a high-level, object-oriented programming language
used to build web apps, mobile applications, and enterprise software
systems. It is known for its Write Once, Run Anywhere capability,
which means code written in Java can run on any device that supports
the Java Virtual Machine (JVM).
Java syntax and structure is similar to C-based languages like C++ and
C#. Its robustness, platform-independent compatibility, and strong
memory management have made it a go-to language for developers
worldwide.
3/9
This Java tutorial is designed for both beginners and
experienced professionals and it covers basic to advanced Java
topics.
Why Learn Java?
Java is used to build Android apps, desktop and web apps,
enterprise backend systems, and cloud-based software.
Java is in high demand with many job opportunities in software
development.
Java has popular frameworks like Spring and Hibernate which
makes Java powerful for enterprise applications.
Java supports object-oriented programming for clean and reusable
code.
It runs on all platforms Windows, Mac, and Linux using the JVM.
Top companies like Amazon, Netflix, and LinkedIn use Java.
Java Hello World Program
Here is a simple Java program that prints "Hello World".
Loading Playground...
// A Java program to print "Hello World"
public class Geeks {
public static void main(String args[])
{
[Link]("Hello World");
}
}
Output
Hello World
Java Basics
Java basics form the foundation of your programming journey, covering
essential concepts like syntax, data types, variables, loops, and
conditionals. Mastering these fundamentals is key to building strong,
error-free Java applications:
Introduction
Download and Install Java
JDK vs JRE vs JVM
Identifiers
Keywords
Quiz: Java Basics and Identifiers
Data Types
Variables
Operators
Quiz: Variables, Operator
Decision Making (if, if-else, switch, break, continue, jump)
Loops
Quiz: Control Statements and Loops
Java Methods
Java methods are reusable blocks of code that perform specific tasks
and help organize your program. They improve code readability, reduce
repetition, and make debugging easier:
Introduction to Methods
How to Call Methods?
Static Methods vs Instance Methods
Access Modifiers
Command Line Arguments
Variable Arguments (Varargs)
Quiz: Methods
Java Arrays
Java arrays are containers that store multiple values of the same data
type in a single variable. They provide an efficient way to manage and
access collections of data using index-based positions:
Introduction to Arrays
Declare and Initialize Arrays
Multi-Dimensional Arrays
Quiz: Java Arrays
Jagged Arrays
Arrays Class
Final Arrays
Java Array Programs
Quiz: Array Programs
Java Strings
Java Strings represent sequences of characters and are widely used in
text processing. They are immutable, meaning once created, their
values cannot be changed:
Introduction of Strings
Why Strings are Immutable?
Java String Concatenation
Quiz: String Basics
String Class
StringBuffer Class
StringBuilder Class
Quiz: String Classes
Strings vs StringBuffer vs StringBuilder
Java String Programs
Java OOPs Concepts
Java follows the Object-Oriented Programming (OOP) paradigm, which
organizes code into classes and objects. Core OOP principles like
inheritance, encapsulation, polymorphism, and abstraction make Java
modular and scalable:
What are OOPs Concepts?
Classes and Objects
Quiz: Classes and Objects
Constructors
Quiz: Constructors
Object Class
Abstraction
Encapsulation
Inheritance
Quiz: Inheritance and Abstraction
Polymorphism
Compile-Time Polymorphism (Method Overloading)
Runtime Polymorphism (Method Overriding)
Packages
Quiz: Polymorphism and Packages
Java Interfaces
Java interfaces define a contract that classes must follow, specifying
method signatures without implementations. They enable abstraction
and support multiple inheritance in Java through a clean, structured
approach:
Java Interfaces
Interfaces and Inheritance
Class vs Interface
Quiz: Interfaces
Functional Interface
Nested Interface
Marker Interface
Comparator Interface
Quiz: Interface types and Comparator
Java Collections
Java Collections provide a framework for storing and manipulating
groups of objects efficiently. It includes interfaces like List, Set, and
Map, along with classes like ArrayList, HashSet, and HashMap:
Java Collection Framework
Collections Class
Collection Interface
Quiz: Collection Framework
List Interface
Quiz: List Interface
ArrayList Class
Quiz: ArrayList
Vector Class
Quiz: Vector
LinkedList Class
Quiz: LinkedList
Stack Class
Set Interface
HashSet Class
Quiz: Set and HashSet
TreeSet Class
LinkedHashSet Class
Queue Interface
Priority Queue Class
Deque Interface
Map Interface
HashMap Class
LinkedHashMap Class
Quiz: Queue and Map Interface
HashTable Class
Quiz: Hashtable
Dictionary
SortedSet Interface
Comparator Interface
Comparable Interface
Comparator vs Comparable
Quiz: Comparator vs Comparable
Iterator
Quiz: Iterators
Java Exception Handling
ava Exception Handling is a mechanism to handle runtime errors,
ensuring the program runs smoothly without crashing. It uses keywords
like try, catch, throw, throws, and finally to manage exceptions:
Java Exceptions
Checked vs Unchecked Exceptions
Try Catch Block
Quiz: Java Exceptions
Final, Finally and Finalize
Throw and Throws
Customized Exception Handling
Chained Exceptions
Null Pointer Exceptions
Exception Handling with Method Overriding
Quiz: Exception Handling
Java Multithreading
Java Multithreading allows concurrent execution of two or more
threads, enabling efficient CPU utilization and faster program
performance. It is commonly used for tasks like parallel processing and
responsive applications:
Introduction to Java Multithreading
Threads
Thread Class
Runnable Interface
Quiz: Thread Basics and Lifecycle
Lifecycle and States of a Thread
Main Thread
Thread Priority in Multithreading
Naming & Feteching Name of Current Thread
[Link]() vs [Link]() Method
[Link]() Method
Daemon Thread
Quiz: Thread Methods and Daemon Threads
Thread Safety
Thread Pools
Java File Handling
Java File Handling enables programs to create, read, write, and
manipulate files stored on the system. It uses classes from the [Link]
and [Link] packages for efficient file operations:
File Handling
File Class
Create Files
Read Files
Quiz: File Handling
Write on Files
Delete File
FileReader Class
FileWriter Class
Quiz: File Writing
FilePermission Class
FileDescriptor Class
Java Streams and Lambda Expressions
Java Streams and Lambda Expressions simplify data processing by
enabling functional-style operations on collections. Lambdas provide
concise syntax for anonymous functions, while Streams allow efficient
filtering, mapping, and reduction of data:
Lambda Expressions
Method References
Java Stream - Complete Tutorial
Quiz: Lambda Expressions and Streams
Java 8 Features - Complete Tutorial
Java IO
Java IO (Input/Output) provides a set of classes and streams to read
and write data from various sources like files, consoles, and network
connections. It is part of the [Link] package and supports both byte
and character streams:
Introduction to Java IO
Reader Class
Writer Class
FileInput Stream
Quiz: IO Basics
FileOutput Stream
BufferedReader Input Stream
BufferedReader Output stream
BufferedReader vs Scanner
Fast I/O
Quiz: BufferedReader vs Scanner and Fast I/O
Java Synchronization
Java Synchronization is used to control access to shared resources in
multithreaded environments. It ensures that only one thread can access
a critical section at a time, preventing data inconsistency:
Java Synchronization
Importance of Thread Synchronization
Method and Block Synchronization
Quiz: Synchronization Basics
Atomic vs Volatile vs Synchronized
Local Frameworks vs Thread Synchronization
Deadlock in Multithreading
Quiz: Deadlocks and Synchronization
Deadlock Prevention and Avoidance
Lock vs Monitor in Concurrency
Reentrant Lock
Quiz: Concurrency Locks and Reentrant Locks
Java Regex
Java Regex (Regular Expressions) allows pattern matching and text
manipulation using the [Link] package. It is powerful for
validating, searching, and replacing strings based on specific patterns:
What is Java Regex?
Pattern Class
Matcher Class
Character Class
Quiz: Regex Basics and Pattern Matching
Quantifiers
Java Networking
Java Networking enables communication between devices over a
network using classes from the [Link] package. It supports protocols
like TCP and UDP for building client-server applications and data
exchange:
Introduction to Java Networking
TCP Architecture
UDP Architecture
IPV4 vs IPV6
Quiz: Networking Basics and Protocols
Connection-Oriented vs Connectionless Protocols
Socket Programming
Server Socket Class
Quiz: Sockets and Server Communication
URL Class and Methods
Java Database Connectivity(JDBC)
Introduction to Java JDBC
JDBC Driver
JDBC Connection
Types of Statements in JDBC
Quiz: JDBC
Java Memory Allocation
Java Memory Allocation refers to how memory is assigned to variables,
objects, and classes during program execution. It involves stack and
heap memory, with the JVM managing allocation and garbage
collection automatically:
Java Memory Management
How Java Objects Stored in Memory?
Quiz: Java Memory Allocation
Stack vs Heap Memory Allocation
Quiz: Heap vs Stack
Java Virtual Machine(JVM) Stack Area
Types of Memory Areas Allocated by JVM
Garbage Collection
Quiz: JVM Memory Management and Garbage Collection
Types of JVM Garbage Collectors
Heap and Stack Memory Allocation
Memory Leaks
Java Interview Questions
Prepare for Java interviews with these commonly asked questions,
covering core concepts, OOP, collections, multithreading, exception
handling, and frameworks like Spring and Hibernate:
200+ Core Java Interview Questions and Answers
Java MCQ
Best Approach to Learn Java
Here’s the step-by-step approach to learn and master
Java efficiently and effectively:
1. Understand Java Fundamentals: Start with the basics: what
Java is, how it works (JVM, JRE, JDK), and why it’s platform-
independent. Learn about Java’s role in building desktop, web, and
mobile applications.
2. Set Up the Java Environment: Install the latest JDK and
configure your development environment. Use a beginner-friendly IDE
like IntelliJ IDEA, Eclipse, or VS Code for writing and testing your code.
3. Learn Core Java Concepts: Focus on essential topics like
variables, data types, operators, control structures (if-else, switch,
loops), and input/output. Practice writing simple programs to strengthen
your understanding.
4. Master Object-Oriented Programming (OOP): Dive into the
pillars of OOP—classes, objects, inheritance, polymorphism,
encapsulation, and abstraction. Understand how Java handles these
concepts and how to apply them effectively in real projects.
5. Explore Collections and Data Structures: Learn about
Java's Collection Framework—ArrayList, HashMap, Set, LinkedList,
and more. Understand how to use them and when to choose one over
the other.
6. Work with Exception Handling: Understand the importance of
error handling in Java using try-catch blocks, finally, throw, and custom
exceptions. Learn best practices for writing clean, safe code.
7. Get Comfortable with File I/O: Learn how Java reads from and
writes to files using File, FileReader, BufferedReader, FileWriter, and
Streams. Practice creating programs that manage and manipulate file
data.
8. Understand Multithreading and Concurrency: Grasp the
basics of threads, synchronization, and concurrent programming. Learn
how Java handles multiple tasks simultaneously using the Thread class
and ExecutorService.
9. Learn Java Libraries and APIs: Familiarize yourself with
essential APIs like Java Math, Date & Time ([Link]), and String
manipulation. Explore popular libraries like Apache Commons, Gson, or
Jackson for real-world development.
10. Build Real-World Projects: Apply your knowledge by building
console apps, file management systems, or basic desktop GUIs using
JavaFX or Swing. Gradually move into web development with Java
Servlets, JSP, or Spring Boot.
Java Program Examples
Java Programming Examples
Java Exercises – Basic to Advanced Java Practice Programs
Java Coding Practice Problems
Java Fundamentals Coding Practice Problems
Java Methods Coding Practice Problems
Java Arrays Coding Practice Problems
Java Strings Coding Practice Problems
Java OOPs Coding Practice Problems
Java Sorting and Searching Algorithms Coding Practice Problems
Java Collections Coding Practice Problems
Java Stream & Lambda Expression Coding Practice Problems
Java Quizzes and MCQs
Java Language MCQs with Answers
Important Java Projects
Number Guessing Game
Simple Banking Application
Currency Converter
Tic-Tac-Toe Game
Snake Game
Memory Game
Chat Application
Face Detection System
Social Networking Site
Text Editor
Career & Jobs in Java 2025
Java opens doors to a wide range of tech careers across industries—
from enterprise software to mobile apps and cloud systems. Here’s a
list of top career options for professionals with Java expertise, along
with their average salary ranges:
Career Average Salary Average Salary
(INR) Per (USD) Per
Annum Annum
₹400,000 –
Java Developer $55,000 – $100,000
₹1,200,000
Full Stack Java ₹700,000 –
$75,000 – $130,000
Developer ₹1,800,000
Career Average Salary Average Salary
(INR) Per (USD) Per
Annum Annum
Backend Engineer ₹800,000 –
$80,000 – $140,000
(Java) ₹2,000,000
Android Developer ₹500,000 –
$60,000 – $110,000
(Java/Kotlin) ₹1,500,000
₹1,500,000 –
Java Architect $120,000 – $170,000
₹3,000,000
DevOps Engineer ₹900,000 –
$90,000 – $150,000
(Java projects) ₹2,200,000
Big Data Engineer ₹1,000,000 –
$100,000 – $160,000
(Java + Hadoop) ₹2,500,000
Automation Test
₹600,000 –
Engineer (Java + $65,000 – $110,000
₹1,400,000
Selenium)
Software Engineer ₹700,000 –
$75,000 – $130,000
(Java Spring Boot) ₹1,800,000
Java Consultant / ₹1,200,000 –
$110,000 – $160,000
Technical Lead ₹2,800,000
List of Companies Using Java
These are some popular companies that use Java in thier workflow:
Company Description
Uses Java for Android development, backend services, and
Google
internal tools across products like Gmail and Google Drive.
Java is widely used at Amazon for building scalable
Amazon backend systems, AWS services, and e-commerce
infrastructure.
Java powers many of Netflix's backend microservices,
Netflix helping deliver content to millions of users with high
availability.
Relies on Java for data processing, backend APIs, and
Spotify
scalable microservices that support music streaming.
Uses Java in its backend systems to handle listings,
Airbnb
payments, and user interactions at scale.
Employs Java for real-time dispatch systems, geolocation
Uber
services, and backend microservices.
Java is a core language for building LinkedIn’s backend
LinkedIn
architecture, handling data-intensive workloads and APIs.
Uses Java for high-traffic applications, auction
eBay
management, and payment services.
Implements Java in various projects, including simulations,
NASA
data analysis tools, and mission-critical software.
Uses Java in embedded systems, performance testing
Intel
tools, and internal applications across chip development
Comment More info
Next Article
Campus Training Program Introduction to Java
Similar Reads
Java IO Tutorial
Java programming language comes with a variety of APIs that helps the
developers to code more efficiently. One of those APIs is Java IO API.…
15+ min read
Java AWT Tutorial
Java AWT or Abstract Window Toolkit is an API used for developing
GUI(Graphic User Interfaces) or Window-Based Applications in Java.…
15+ min read
Maven Tutorial
Maven is a powerful project management and build automation tool,
widely used by Java developers. It uses a Project Object Model (POM) …
15+ min read
Android Tutorial
In this Android Tutorial, we cover both basic and advanced concepts. So
whether you are a fresher (graduate) or an experienced candidate with…
15+ min read
Java Variables
In Java, variables are containers that store data in memory.
Understanding variables plays a very important role as it defines how…
15+ min read
Java Networking
When computing devices such as laptops, desktops, servers,
smartphones, and tablets and an eternally-expanding arrangement of I…
15+ min read
Julia vs. Java
What is Java? Java is one of the most popular and widely used
programming language and platform. A platform is an environment that…
15+ min read
Java Operators
Java operators are special symbols that perform operations on variables
or values. These operators are essential in programming as they allow…
15+ min read
Java URL Class
URL class in Java is a part of [Link] package that makes it easy to work
with Uniform Resource Locators (URLs). URL is simply a string of text…
15+ min read
Java Syntax
Java is an object-oriented programming language that is known for its
simplicity, portability, and robustness. The syntax of Java programming…
15+ min read
geeksforgeeks-footer-logo
Corporate & Communications
Address:
A-143, 7th Floor, Sovereign
Corporate Tower, Sector- 136, Noida,
Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante
Apartment, Sector 137, Noida,
Gautam Buddh Nagar, Uttar Pradesh,
201305
GFG App on Play GFG App on App
Store Store
Advertise with us
Company Explore
About Us Job-A-Thon
Legal Offline Classroom Program
Privacy Policy DSA in JAVA/C++
Careers Master System Design
In Media Master CP
Contact Us Videos
Corporate Solution
Campus Training Program
Tutorials DSA
Python Data Structures
Java Algorithms
C++ DSA for Beginners
PHP Basic DSA Problems
GoLang DSA Roadmap
SQL DSA Interview Questions
R Language Competitive Programming
Android
Data Science & ML Web Technologies
Data Science With Python HTML
Machine Learning CSS
ML Maths JavaScript
Data Visualisation TypeScript
Pandas ReactJS
NumPy NextJS
NLP NodeJs
Deep Learning Bootstrap
Tailwind CSS
Python Tutorial Computer Science
Python Examples GATE CS Notes
Django Tutorial Operating Systems
Python Projects Computer Network
Python Tkinter Database Management System
Web Scraping Software Engineering
OpenCV Tutorial Digital Logic Design
Python Interview Question Engineering Maths
DevOps System Design
Git High Level Design
AWS Low Level Design
Docker UML Diagrams
Kubernetes Interview Guide
Azure Design Patterns
GCP OOAD
DevOps Roadmap System Design Bootcamp
Interview Questions
School Subjects Databases
Mathematics SQL
Physics MYSQL
Chemistry PostgreSQL
Biology PL/SQL
Social Science MongoDB
English Grammar
Preparation Corner More Tutorials
Company-Wise Recruitment Process Software Development
Aptitude Preparation Software Testing
Puzzles Product Management
Company-Wise Preparation Project Management
Linux
Excel
All Cheat Sheets
Courses Programming Languages
IBM Certification Courses C Programming with Data Structures
DSA and Placements C++ Programming Course
Web Development Java Programming Course
Data Science Python Full Course
Programming Languages
DevOps & Cloud
Clouds/Devops GATE 2026
DevOps Engineering GATE CS Rank Booster
AWS Solutions Architect Certification GATE DA Rank Booster
Salesforce Certified Administrator Course GATE CS & IT Course - 2026
GATE DA Course 2026
GATE Rank Predictor
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved