Java tutorial for beginners and professionals with examples on Basics, OOPs, Methods, Overloading, Overriding, Inheritance, Polymorphism, Interfaces, Packages, Abstract classes, String handling, Exception handling, IO, Collections, Multithreading, Serialization and more.
We are going to start learning Java, which is a programming language. So, let us have a brief look at programming language first.
What is language?
A way of communication is known as language. e.g. Hindi, English, etc.
What is a Program?
A set of instructions which is used to perform a specific task.
What is a Programming Language?
An artificial language is used to write programs that can be translated into machine language and executed by computer with the help of some special software.
What is a Platform?
Dictionary meaning: A raised level surface on which things can stand.
In programming: Hardware or software on which a program can execute/run.
e.g. – c, c++, Java etc.
What is Java?
Java is a high-level programming language and is also known as the platform because of its JRE (java runtime environment).
Brief History of Java.
Java language project was initially started in June 1991 by James Gosling, Mike Sheridan, and Patrick Naughton. An oak tree stood outside Gosling’s office at that time and java was named as oak initially. It was later renamed Green and was later renamed Java from Java Coffee.
The base concept of Java language project.
Write once, run anywhere (WORA) – that means Java program can run anywhere and on any platform. When Java code is compiled it is converted into byte code. Now only this byte code is needed to run using JVM, no need for source code and recompilation.
Java released versions:
- JDK Alpha and Beta (1995)
- JDK 1.0 (23rd Jan, 1996)
- JDK 1.1 (19th Feb, 1997)
- J2SE 1.2 (8th Dec, 1998)
- J2SE 1.3 (8th May, 2000)
- J2SE 1.4 (6th Feb, 2002)
- J2SE 5.0 (30th Sep, 2004)
- Java SE 6 (11th Dec, 2006)
- Java SE 7 (28th July, 2011)
- Java SE 8 (18th March, 2014)
- Java SE 9 (21th Sept, 2017)
- Java SE 10 (20th March, 2018)
- Java SE 11 (25th Nov, 2018)
- Java SE 12 (19th March, 2019)
Java Tutorial:
- Features of Java | New Java Features
- JVM | Java Virtual Machine
- JVM JRE JDK Architecture | JVM vs JRE vs JDK
- Naming Conventions in Java
- Java Variables
- Java Data Types
- Java Int
- Java Hello World Example
- Java Operators
- Java If else
- Java Switch Statement
- Java For Loop
- Java Enhanced For Loop
- Java While Loop
- Java Do While Loop
- Java Break Statement
- Java Continue Statement
- Object-oriented programming style
- Objects and Classes in Java
- Java OOPs Concepts
- Abstraction in java
- Encapsulation in java
- Polymorphism in java
- Method overloading in java
- Java Method overriding
- Java Dynamic Method Dispatch | Runtime Polymorphism In Java
- Java Association Aggregation And Composition
- Java Inheritance
- Java Command Line Arguments
- Java Abstract Class
- Java Interface
- Java Marker interface
- Java Constructor
- Package in java
- Java Access Modifier
- Java Static import
- Java Package class
- Java this keyword
- Java Instance Initializer block
- Java Super keyword
- Java Static keyword
- Java final keyword
Java Examples:
- Java examples programs
- Program to print alphabets both in small and capital
- Java Arithmetic Operations Example
- Java Armstrong Number Program
- Java Even Odd Program
- Java Factorial Program
- Java Factorial Program Using Recursion
- Java Fibonacci Series Program
- Java Palindrome Number Program
- Java Prime Number Program
- Java Swap Two Numbers Without Using Third Variable
- Java Swap Numbers
- Java Reverse Number
- Java Calculate Circle Area
- Java Calculate Circle Perimeter
- Calculate Rectangle Area using Java Example
- Java Calculate Rectangle Perimeter
- Java Leap year
- Java List Even Numbers
- Java List Odd Numbers
- Java Floyd Triangle
- Java Generate Pyramid For a Given Number
- Java Generate Pyramid Triangle
- java number pattern programs
- java star pattern programs
- sum of digits in java
Java Cloning:
Java String:
Java String Handling:
- Java String handling
- Java String comparison
- Java String Concatenation
- Java Substring
- Create Immutable class in java
- Java toString() method
- Java string class methods
- Java String charAt() Method
- Java String startsWith() | Java String endsWith()
- Java String indexOf() | Java String lastIndexOf()
- Java String toLowerCase | Java String toUpperCase
- Java String intern() Method
- Java String length() Method
- Java String trim() Method
- Java String to int
- Java String to integer with leading zeros
- Java Int to string
- Java String to double
- Double to string in java
- String to long in java
- Long to string in java
- String to boolean in java
- Boolean to string in java
- Char to string in java
- String to char in java
- Char array to string in java
- String to date in java
- Date to string in java
- Ascii to string in java
- Float to string in java
- String to arraylist in java
- how to create random string in java?
Java String Buffer Tutorial:
- Java StringBuffer
- Java StringBuffer append() Method
- Java StringBuffer insert() Method
- Java StringBuffer replace() Method
- Java StringBuffer delete() Method
- Java StringBuffer reverse() method
- Java StringBuffer capacity() Method
- Java StringBuffer ensureCapacity() Method
Java String Builder Tutorial:
- Java StringBuilder
- Java StringBuilder append() method
- Java StringBuilder insert() method
- Java StringBuilder replace() method
- Java StringBuilder delete() method
- Java StringBuilder reverse() method
- Java StringBuilder capacity() method
- Java StringBuilder ensureCapacity() method
- Append character at first position in StringBuilder java
Java String Tokenizer:
Java Exception Handling Tutorial:
- Java Exception handling tutorial
- Exception handling in java
- try and catch blocks in java
- Java Multiple catch blocks
- Java Nested try block
- Java finally Keyword
- Java throw keyword
- Java throws keyword
- Java Exception propagation
- Java Exception handling with method overriding
- Java Custom exception
- Java Throwable class methods
Java Multithreading Tutorial:
Java Multithreading Tutorial
- Thread life cycle in java
- Way of creating thread in java
- Methods of Thread class
- Thread Scheduling in java
- Thread priority in java
- Naming a thread in java
- Joining a thread in java
- Daemon thread in java
- Can we start a thread twice?
- Can we call run method directly?
- Thread.yield() and Thread.sleep() methods
- Deadlock in java
- Starvation in java
- Synchronization in java
- Synchronized method in java
- Static synchronization in java
- Synchronized block in java
- Inter-thread communication in java
Java Concurrency Tutorial:
- Concurrency in java
- Concurrency issues
- Concurrency solutions
- Reentrantlock in java
- Readwritelock in java
- Semaphore in java
- Countdownlatch in java
- Exchanger in java
- Atomic variable in java
- Atomic boolean
- Atomic integer
- Atomic long
- Atomic integer array
- Atomic long array
- Thread pool in java
- Thread group in java
- Shutdown hook in java
- Executor framework
- Fork join in java
- Callable and Future
- Runnable vs Callable
Java Collection Tutorial:
- Collection tutorial java
- Collection interfaces in java
- Collection interface in java
- List interface in java
- Set interface in java
- SortedSet interface in java
- Map interface in java
- Save map in file java
- How to create synchronized map?
- how to create immutable map in java?
- Map.Entry interface in java
- SortedMap interface in java
- Queue interface in java
- Deque interface in java
- Enumeration interface in java
- Collection classes in java
- HashSet in java
- LinkedHashSet in java
- TreeSet in java
- ArrayList in java
- LinkedList in java
- HashMap in java
- LinkedHashMap in java
- TreeMap in java
- Abstract classes in collection framework
- PriorityQueue in java
- Max value in priority queue java
- ArrayDeque in java
- Sorting in collection framework
- Comparable interface in java
- Comparator interface in java
- Properties class in java
- Hashtable in java
- hashCode and equals method in java
- ListIterator interface in java
- Java collections class
- How to add all elements to the given collection object?
- Iterate collection objects in java
- Remove element from collection
- Java Collections.asLifoQueue() method
- Java Collections.checkedCollection() method
- Java Collections.checkedList() method
- Java Collections.checkedSet() method
- Java Collections.checkedMap() method
- Java Collections.disjoint() method
- How to create empty list using Collections class?
- How to create empty set using Collections class?
- How to create empty map using Collections class?
- How to find repeated element count in a collection?
- collection framework interview programs in java
LinkedList:
- Read all elements in linkedlist in java
- Copy or clone linked list in java
- Add all elements of a list to linkedlist in java
- Remove all elements from a linked list in java
- Linked list to array in java
- Sort linkedlist using comparator in java
- Reverse linked list in java
- Shuffle elements in linked list in java
- Swap two elements in a linked list java
- Add an element at first and last position of linked list
- Get first element in linked list in java
- Get last element in linked list in java
- how to iterate through linked list in reverse order?
- linked list push and pop in java
- Remove element from linkedlist in java
- Remove duplicate elements from a linked list in java
Hashtable:
- Iterate through hashtable in java
- Copy map content to another hashtable
- Search a key in hashtable
- Search a value in hashtable
- Get all keys from hashtable in java
- Get entrySet from hashtable in java
- Remove all elements from hashtable in java
- hash table implementation with equals and hashcode example
- Eliminate duplicate keys user defined objects with Hashtable
Hashset:
- Iterate a hashset in java
- Copy set content to another hashset in java
- Remove all elements from hashset in java
- Hashset to array in java
- Eliminate duplicate user defined objects from hashset in java
- Iterate a linkedhashset in java
- Linkedhashset to array in java
- Add all elements of a set to linkedhashset in java
- Remove all elements from linkedhashset in java
- Delete specific element from linkedhashset
- Check if a particular element exists in LinkedHashSet
- Eliminate duplicate user defined objects from linkedhashset
- how hashset works internally in java?
Treeset:
- Create treeset in java
- Iterate treeset in java
- List to treeset in java
- Avoid duplicate user defined objects in TreeSet
Set:
- Get least value element from a set
- Get highest value element from a set
- How to create synchronized set?
- how to create immutable set in java?
Hashmap:
- Create hashmap in java
- Iterate hashmap in java
- Copy map content to another hashmap in java
- Search a key in hashmap in java
- Search a value in hashmap in java
- Get list of keys from hashmap java
- Get entryset from hashmap in java
- Delete all elements from hashmap in java
- Eliminate duplicate user defined objects as a key from hashmap
- Create linkedhashmap in java
- Iterate linkedhashmap in java
- Search a key in linkedhashmap in java
- Search a value in linkedhashmap in java
- Remove all entries from linkedhashmap
- Eliminate duplicate user defined objects as a key from linkedhashmap
- Find user defined objects as a key from linkedhashmap
- HashMap internal working in java
- How hashmap stores null key?
Treemap:
- Create treemap in java
- Iterate treemap in java
- Copy map content to another treemap
- Search a key in treemap in java
- Search a value in treemap in java
- Get all keys from treemap in java
- Get entryset from treemap in java
- Remove all elements from a treeMap in java
- Sort keys in treemap by using comparator
- Get first key element from treemap in java
- Get last key element from treemap in java
- Reverse sort keys in a treemap
List:
- how to replace element in list java?
- How to convert enumeration to list in java?
- How to get index of a sub list from another list?
- How to get last index of a sub list from another list?
- How to get max element from the given list?
- How to get min element from the given list?
- How to get max element of a list of user defined objects?
- How to get min element of a list of user defined objects?
- How to get max element of a list of user defined objects using Comparator?
- How to get min element of a list of user defined objects using Comparator?
- How to create multiple copies of a given object?
- How to replace all occurrences of a given object in the list?
- how to rotate element in list java?
- how to create synchronized list in java?
- How to search user defined object from a List by using binary search using comparator?
- how to create immutable list in java?
- Random element from a list java
Java Runtime Tutorial:
- Java Runtime exec() method
- Shutdown system in Java
- Shutdown windows system in Java
- Restart system in Java
- Java Runtime availableProcessors
- Java Runtime freeMemory() and totalMemory() method
Java Input Output Stream Tutorial:
Java Array:
- Arrays in Java
- Display arraylist values by using iterator in java
- Copy or clone a arraylist in java
- Add all elements of a list to arraylist in java
- Remove all elements from arraylist in java
- Arraylist to array in java
- Get sublist from arraylist in java
- Short arraylist using comparator in java
- Reverse contents of arraylist in java
- Shuffle elements in an arraylist in java
- Swap two elements in an arraylist in java
- Remove duplicate elements from arraylist in java
- Remove duplicate entries from an array in java
- Find duplicate value in an array in java
- java enumeration for arraylist
- Get minimum value in Arraylist java
- Get maximum value in Arraylist java
- Find duplicate elements in an array in java
- Find second largest element in an array in java
- Check the equality of two arrays in java
- Find all pairs of elements in an integer array whose sum is equal to a given number
- Find continuous sub array whose sum is equal to a given number in java
- Find the intersection of two arrays in java
- Separate zeros from non-zeros in an integer array in java
- Find all the leaders in an integer array in java
- Find a missing number in an integer array in java
- Array to ArrayList and an ArrayList to array in java
- Count occurrences of each element in an array in java
- Reverse an array without using an additional array in java
- Remove duplicate elements from an array in java
- Find union and intersection of multiple arrays in java
- Find the most frequent element in an array in java
- java array interview programs
Vector:
- Vector class in Java
- Read all elements in vector
- Copy or clone a vector in java
- Add all elements of a list to vector in java
- Remove all elements from vector in java
- Copy vector to array in java
- Get sub list from vector in java
JavaFx:
jFrame:
- jFrame set size
- Java full screen jFrame
- close a jframe in java with an if statement
- Java create jframe
jLable:
- java random class tutorial
- Java Type Casting
- Java Type Casting
- Java Wrapper Classes
- Inner Class Java
- Java networking tutorial
- java get screen size
- Android manifest cleartext traffic permitted
- Seconds To Hours Java
- Executing an EXE from Java and getting input and output from EXE
- Java int to roman
- Get player from UUID
- java.awt.event is not accessible
- import math java
- RGB to HEX java
- ANSI Colors Java
- Console log java
- Java console and terminal color
- Change java version command line debian
- Ubuntu change java version Linux
- Java create window
- Change font size java swing
- Random colors java
- Java every second
- java age from date
- Left fold java
- Lombok maven dependency
- Bukkit scoreboard
- Spigot repeating task
- Java log base 2
- Java get next enum
- set java_home in mac
- set java_home in mac
- Top Wishlisted games on steam
- Get class by name java
- Java get mouse position on screen
- Sleep in java
- Maven java 8
- Error:java: Source option 5 is no longer supported. Use 6 or later.
- Error:java: Source option 5 is no longer supported. Use 7 or later.
- Zufallszahlen in java
- Send action bar spigot
- Java FileWriter new line
- Java execution time
- Exit from jshell
- Copy to clipboard java
- Upgrade java 8 to 11 in ubuntu
- Java stream find specific element
- Show dialog fragment from adapter
- Detect operating system in java
- Best ASCII art characters
- Bukkit inventory set name
- Spring boot maven run with profile
- Divide with float java
- SpringBoot starter jpa
- Regrex for letter in java
- Hardware assisted virtualization and data execution protection must be enabled in the BIOS
- Spigot spawn entity
- No Java files found that extend CordovaActivity
- Echo java_home in windows cmd
- How to generate same random number sequence every time?
- how to create random alphanumeric in java?
- How to generate random numbers in a given range in java?
- java visitor design pattern
- java memento design pattern
- how to get hostname from ip address in java?