Table of Contents
- 1. Introduction
- 2. What is Java?
- 3. Java Program Example
- 4. Core Java tutorial
- Chapter 1: Java Basics
- Chapter 2: Java Control Statements
- Chapter 3: Object-Oriented Programming concepts
- Chapter 4: Java Collections
- Chapter 5: Java Multithreading
- Chapter 6: Java Executor Framework
- Chapter 7: Java Concurrency util
- Chapter 8: Java Serialization
- Chapter 9: Java Exception Handling
- Chapter 10: Java 8
- Chapter 11: String Handling
- Chapter 12: Java IO
- Chapter 13: Memory
- Chapter 14: Java Interview Programs
- Chapter 15: Interview Questions
- 5. Applications of Java Programming
- 6. Java Platforms / Editions
- 7. Prerequisites for Java
- 8. Why Learn Java Programming?
1. Introduction
This blog post offers a comprehensive Core Java tutorial tailored for both beginners and experienced programmers. The topics compiled and presented in this tutorial will help you build your foundation in Java, covering both the basic fundamental topics and the advanced topics that will make you an expert in Java.
It will definitely help you learn Java in a better way, with a deeper understanding of each and every topic that every novice or expert Java programmer should be aware of.
2. What is Java?
Java is a programming language and computing platform first released by Sun Microsystems in 1995. It is now maintained by Oracle, which releases a new version of the language every year.
It is widely used and recommended across various application development platforms due to its Object-Oriented Programming Paradigm. This paradigm helps programmers write and maintain code in a unique, efficient, and secure manner.
As of the date of publishing this post, Java 21 is the latest version available on the Oracle Java SE Platform. Each new version improves and adds new features to Java for developers worldwide.
3. Java Program Example
Here, we will take a look at a sample Java Hello World program to give an overview of this language and what a simple Java program looks like.
We’ll discuss a sample code snippet to give you a taste of what we’re diving into. Don’t worry if you don’t understand the code right away. Each keyword and its explanation will be provided step by step as you proceed with this Core Java tutorial.
File Name: Sample.java
1 2 3 4 5 6 7 8 9 |
class Sample { public static void main(String args[]) { System.out.println("Welocme to Core Java Tutorial by Java2Blog"); } } |
For a beginner, the code above might not look familiar. To understand this, along with various key concepts, follow the outlined tutorial below to strengthen your basics.
4. Core Java tutorial
Chapter 1: Java Basics
Chapter 2: Java Control Statements
Java control statements control the order of execution based on some conditions or looping statements. It includes for, do, do-while, if-else, Switch case, continue and break statements, etc.
Chapter 3: Object-Oriented Programming concepts
OOP’s concepts are the building blocks of the Java language. The four most important concepts of Java are – Abstraction, Encapsulation, Inheritance, Polymorphism.
- Constructor in java
- Interface in java with example
- Abstract class in java
- Difference between Abstract Class and Interface in java
- Abstraction in java with example
- Encapsulation in java with example
- Polymorphism in java with example
- Inheritance in java with example
- Method overriding in java
- Method overloading in java
Chapter 4: Java Collections
Java collections APIs provide lots of inbuilt classes and interfaces to handle collections of objects. It is very essential to learn and master java collections concepts. It is a very important part of the core java tutorial.
- HashMap in java with examples
- LinkedHashMap in java with example
- TreeMap in java with examples
- TreeSet in java
- ArrayList in java
- LinkedHashSet in java
- ConcurrentHashMap in java
- hashcode() and equals() method in java
- How HashMap works in java
- How HashSet works in java
- Comparable in java
- Comparator in java
- Difference between Comparator and Comparable in java
- How to iterate a list in java
- How to remove duplicates from ArrayList in java
- How to iterate over Map or HashMap in java
- Difference between ArrayList and Vector in java
- Difference between HashMap and HashSet in java
- Difference between Hashtable and HashMap in java
- Difference between ArrayList and LinkedList in java
- Difference between Iterator and ListIterator in java
Chapter 5: Java Multithreading
Thread can be called a lightweight process. Java supports multithreading, so it allows your application to perform two or more tasks concurrently.
Multithreading can be of advantage especially when nowadays, the machine has multiple CPUs, so multiple tasks can be executed concurrently. It is a very important part of the core java tutorial.
- Java Thread example
- Difference between process and thread in java
- Java Thread Sleep Example
- Java Thread Join Example
- Daemon thread in java with example
- Object level locking vs Class level locking in java
- wait, notify, and notifyAll method in java with example
- Can we start a thread twice in java
- Can we call run() method directly to start a new thread
- Difference between notify and notifyAll in java
- How to print even and odd numbers using threads in java
- Print sequence using 3 threads in java
Chapter 6: Java Executor Framework
Java 5 has introduced a new concurrent API called “Executor frameworks” to make programmer life easy. It simplifies the design and development of multi-thread applications.
It consists of mainly Executor, ExecutorService interface, and ThreadPoolExecutor class which implements both interfaces i.e. Executor and ExecutorService. ThreadPoolExecutor class provides the implementation of the thread pool.
Chapter 7: Java Concurrency util
Java 5 has added a new package java.util.concurrency.This package includes lots of classes which makes it easier to develop a multithreaded application.
Chapter 8: Java Serialization
Serialization is one of the most important concepts in Java. If you are going to face the core java interview, then you might be asked some questions from Serialization.
Java provides a mechanism called serialization to persists Java objects in a form of ordered or sequence of bytes that includes the object’s data as well as information about the object’s type and the types of data stored in the object
Chapter 9: Java Exception Handling
An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program’s instructions. It is a very important part of the core java tutorial.
Chapter 10: Java 8
Java 8 has introduced lots of new features such as Lambda expressions, streams, default methods, functional interfaces, etc.
- Java 8 tutorial
- Lambda Expressions in Java 8
- Interface default methods in java 8
- Java 8 Lamba Expression examples using Comparator
- Java 8 functional interface example
- Java 8 Parallel Stream
- Java 8 Predicate examples
- Java 8 Collectors examples
- Java 8 Supplier example
- Java 8 Consumer example
- Java 8 Stream filter examples
- Java 8 forEach examples
- Collectors.groupby example : How to do group by in java
- Java 8 Optional
- Java 8 Stream Map
- Java 8 Stream FlatMap
Chapter 11: String Handling
11.1: String Methods
- Java String equals example
- Java String equalsIgnoreCase example
- Java String contentEquals example
- Java String compareTo example
- Java String contains example
- Java String concatenate example
- Java String startsWith example
- Java String endsWith example
- Java String charAt example
- Java String trim example
- Java String regionMatches example
- Java String isEmpty example
- Java String length example
- Java String join example
11.2: String Programs
- Java program to reverse a String
- Find all substrings of a String in java
- Find first non repeated character in a String
- How to split a String in java
- Java Program to find duplicate Characters in a String
- How to check if two Strings are Anagrams in Java
- How to check if one String is a rotation of another String in java
- How to check if String has all unique characters in java
- Find the length of String without using java inbuilt length method
- Find all Permutations of a String in java
- How to convert Char Array to String in java
- How to convert String to Char Array in java
- How to convert Byte Array to String in java
- How to remove non-ascii characters from a string in java
Chapter 12: Java IO
- How to get size of file in java
- How to check if a file exists in Java
- How to get extension of file in java
- How to download a file from URL in java
- How to delete non-empty directory in java
- How to get all files with certain extension in a folder in java
- How to get last modified date of file in java
- How to write an object to a file in java
- How to read an object from a file in java
- How to read properties file in java
- Read a file from resources folder in java
- How to make a file read-only in java
- How to rename a file in java
- How to move a file to another directory in java
- How to get the current working directory in java
- How to get home directory in java
- How to read excel files in java using Apache POI
- How to write Excel files in java using Apache POI
- How to set style in excel using Apache POI in java
- Working with formulas in excel using Apache POI in java
Chapter 13: Memory
Chapter 14: Java Interview Programs
Chapter 15: Interview Questions
These are the most important java interview questions which are frequently asked. It will help you to crack the core java interview.
- Java interview questions
- Core java interview questions
- Java Collections interview questions
- OOPs interview questions in java
- Java Multithreading interview questions
- Java String interview questions
- Exceptional handling interview questions in java
- Java Serialization interview questions in java
- Method overloading and overriding interview questions
- Java interview questions for 5 years experienced.
- Java Interview questions for 2 years experienced
5. Applications of Java Programming
Java is a robust Programming language and its applications are vast in the field of Software/Application development. Though we can streamline its major applications in various sectors:
-
Developing Interactive Desktop GUI Applications in Java- All desktop applications can easily be developed in Java. Java provides GUI development through APIs like AWT, Swing, JavaFX to build these applications. Common Examples include Media Player, Antivirus Software, etc.
-
Developing Mobile Application using Java: Java is considered the official programming language for mobile app development. It is compatible with software such as Android Studio and Kotlin. Java’s Micro Edition or
JME
is also a cross-platform framework used for applications running on mobile and other devices. -
Developing Server and Web-Based Application using Java: Java has a very big name in the financial services industry, many global investment banks Goldman Sachs, Standard Chartered, Barclays use Java as their most sought after business requirement implementation language. It is also prominent in government, healthcare, and insurance sectors where the Web Applications for them are built-in Java.
- Developing Software Tools: Many useful software and development tools are written and developed in Java, like Eclipse IDE, IntelliJ Idea, and NetBeans IDE. These applications have their wide use in developing Java Applications for enterprises and other sectors.
6. Java Platforms / Editions
To date, the Java Programming Language provides four platforms for developing Java Applications cross-platform depending on the requirements and platform dependency of the application.
- Java Standard Edition (Java SE): Java SE’s API provides the core functionality of the Java programming language. Beginners in Java should use this edition to understand Core Java in depth. It defines everything from the basic types and high-level classes used for networking, security, database access, to graphical user interface (GUI) development.
- Java Enterprise Edition (Java EE): The Java EE platform is built on top of the Java SE platform. It adds features for developing generally scalable web applications or applications used by enterprises or industries. The Java EE platform provides an API and runtime environment for developing and running large-scale, multi-tiered, scalable, reliable, and secure applications.
- Java Micro Edition (Java ME): The Java ME API is a subset of the Java SE Edition, with some special libraries useful for making applications compatible with small devices such as mobile phones. With the advent of Android, the Java ME Edition has become obsolete and is not much used these days.
- Java FX: Java FX technology is a platform for creating rich internet applications written in JavaFX Script. JavaFX Script is a statically-typed declarative language with internal features similar to Java, and it can run on any Java Virtual Machine.
7. Prerequisites for Java
If you’re new to learning any language, it’s better to have some knowledge about the needs and prerequisites so that your learning is never hampered, and you can cover the topics easily without any confusion.
However, there are some prerequisites for learning Java, and we recommend that you follow these for a better experience.
- If you’re new to the world of programming with no prior experience and want to start with Java as your first language, we recommend becoming familiar with the Fundamentals of Programming. Although learning Java doesn’t require specialization in any other language, it will still help you a lot.
- Now, if you have any prior experience with programming, for example, being conversant with the C programming language will definitely be a plus point on your road to learning Java, as part of the syntax and semantics of Java are closely related to C.
- As Java is an Object-Oriented Language, being introduced to object-oriented principles, such as having an understanding of languages like C++, Perl, or Python, will be very beneficial.
- In short, a strong desire or passion to learn Java will help you the most. An eagerness to search Google for documentation will greatly enhance your learning experience.
8. Why Learn Java Programming?
In today’s world, Java has become one of the most popular programming languages. As more industries shift to using Java for building projects and reliable applications, the demand for Java has increased significantly in the past decade.
We highlight a few points on why java is an essential skill today:
- Easy to Learn: Java is easy to learn because most of its syntax, built-in methods, and classes follow naming conventions that use simple English.
- Free of Cost: One of the reasons it is popular among developers is that the Java Development Kit (JDK) is available for free, licensed by Oracle on their website.
- Platform Independence: Java is a platform-independent programming language, which means developers worry less while coding. Its “Write Once, Run Anywhere” feature attracts more and more programmers every year.
- Large Documentation and Community Support: Javadoc support provided by Oracle serves as a valuable reference while coding in Java, making it quite simple to understand the code. Additionally, popular online communities like StackOverflow, Stack Exchange, Java Forums, etc provide innumerable resources for java.
That concludes our Core Java tutorial for both beginners and experienced programmers. We’ve highlighted the essential points for beginners to become experts in Java.
We will continue to add more links to this Core Java tutorial. If you have any topics to suggest, please leave a comment.