Loading...

Go Back

Next page
Go Back Course Outline

Java Full Course


Introduction to Java

Learn the fundamentals of Java - one of the world's most popular programming languages

History and Evolution

Java was created by James Gosling and his team at Sun Microsystems in 1991. Originally named "Oak", it was designed for interactive television but was too advanced. It was later renamed to Java and released in 1995.

Key Milestones:

  • 1995 - Java 1.0 released
  • 1998 - Java 1.2 (Java 2 Platform)
  • 2004 - J2SE 5.0 (major features added)
  • 2014 - Java SE 8 (Lambda expressions)
  • 2017 - Java SE 9 (Module system)
  • 2023 - Java 21 (Virtual threads)

Java was designed with the principles of "Write Once, Run Anywhere" (WORA), meaning compiled Java code can run on all platforms without recompilation.

Features of Java

Core Features:

  • Platform Independent - Java code compiles to bytecode that runs on any JVM
  • Object-Oriented - Everything in Java is an object
  • Robust - Strong memory management, exception handling, and type checking
  • Secure - Provides a secure execution environment
  • Multithreaded - Supports concurrent programming
  • Distributed - Designed for distributed environments
  • Dynamic - Capable of adapting to evolving environments

Java Editions:

  • Java SE (Standard Edition) - Core Java for desktop and server applications
  • Java EE (Enterprise Edition) - For enterprise-level applications
  • Java ME (Micro Edition) - For mobile and embedded systems
Setting Up Java Development Kit (JDK)

To start Java development, you need to install the Java Development Kit (JDK). The JDK includes:

  • Java Runtime Environment (JRE)
  • Compiler (javac)
  • Debugger
  • Development tools

Installation Steps:

  1. Download JDK from Oracle's website (or use OpenJDK)
  2. Run the installer and follow the instructions
  3. Set the JAVA_HOME environment variable
  4. Add JDK's bin directory to your PATH
Verifying JDK Installation (Command Line)
java -version
Output:
java version "21.0.1" 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)
Installing and Using an IDE

An Integrated Development Environment (IDE) makes Java development much easier by providing:

  • Code editor with syntax highlighting
  • Debugger
  • Code completion
  • Build automation
  • Version control integration

Popular Java IDEs:

Eclipse

Open-source, widely used, extensive plugin ecosystem

IntelliJ IDEA

Highly intelligent, excellent code analysis, commercial with free community edition

NetBeans

Official IDE from Oracle, excellent Swing GUI builder

Installation Steps for IntelliJ IDEA:

  1. Download IntelliJ IDEA from jetbrains.com
  2. Run the installer
  3. Configure JDK path during setup
  4. Create a new Java project
Writing Your First Java Program

The traditional "Hello World" program is the first step in learning any programming language. Here's how it looks in Java:

HelloWorld.java
public class HelloWorld {
    // This is the main method where execution begins
    public static void main(String[] args) {
        // Print "Hello, World!" to the console
        System.out.println("Hello, World!");
    }
}

Compilation and Execution Process:

  1. Compilation: Convert .java file to .class bytecode
  2. Execution: Run the bytecode using Java Virtual Machine (JVM)
Compiling and Running (Command Line)
Compile Java source file
javac HelloWorld.java

# Run the compiled program
java HelloWorld
Output:
Hello, World!

Understanding the Code:

  • public class HelloWorld - Defines a class named HelloWorld
  • public static void main(String[] args) - Entry point of the program
  • System.out.println() - Method to print text to console
Go Back

Next page