Java Full Course

Java Full Course

Complete Written Guide for Java Programming

Introduction

Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.

Java Basics

1. What is Java?

Java is a high-level, object-oriented programming language. It is designed to be platform-independent, meaning Java programs can run on any device that has a Java Virtual Machine (JVM). Java follows the principle: "Write Once, Run Anywhere". It is widely used for desktop apps, web apps, mobile apps, and more.

2. Hello World Program

The simplest Java program prints a message to the screen.


public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
      

- Every Java program must have a class.
- The main method is the entry point of the program.
- System.out.println() prints text to the console.

3. Basic Syntax and Data Types

Variables store data. Common data types include:

  • int — integer numbers (e.g., 5, -10)
  • double — decimal numbers (e.g., 3.14)
  • boolean — true or false
  • char — a single character (e.g., 'A')
  • String — sequence of characters (text)

int age = 25;
String name = "Alice";
boolean isStudent = true;
      

4. Control Structures

If-Else Statement: Makes decisions based on conditions.


if (age >= 18) {
    System.out.println("Adult");
} else {
    System.out.println("Minor");
}
      

Loops: Repeat code multiple times.

For loop example:


for (int i = 0; i < 5; i++) {
    System.out.println(i);
}
      

While loop example:


int i = 0;
while (i < 5) {
    System.out.println(i);
    i++;
}
      

5. Methods (Functions)

Methods group reusable blocks of code.


public static int add(int a, int b) {
    return a + b;
}
      

You call it like this:


int result = add(3, 4);
      

6. Object-Oriented Programming (OOP)

Java is based on objects and classes.

A class is a blueprint for objects, and an object is an instance of a class.


public class Dog {
    String name;

    public void bark() {
        System.out.println(name + " says Woof!");
    }
}

Dog myDog = new Dog();
myDog.name = "Buddy";
myDog.bark();  // Outputs: Buddy says Woof!
      

Object-Oriented Programming

  • Classes and Objects
  • Inheritance
  • Polymorphism
  • Abstraction
  • Encapsulation

Advanced Topics

  • Exception Handling
  • Collections Framework
  • Multithreading
  • File I/O
  • JDBC

Projects

Practice projects like:

  • Bank Management System
  • Library Management System
  • Student Information System

© 2025 Java Course. All rights reserved.

Comments

Popular Posts