0% found this document useful (0 votes)
2 views

Java_Notes_Beginner_Detailed

This document provides an introduction to Java programming, covering its history, development tools, and how Java code runs. It outlines key concepts such as variables, data types, and operators, along with common mistakes beginners might encounter. The document includes mini exercises to reinforce learning through practical application.

Uploaded by

petergoel1705
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Java_Notes_Beginner_Detailed

This document provides an introduction to Java programming, covering its history, development tools, and how Java code runs. It outlines key concepts such as variables, data types, and operators, along with common mistakes beginners might encounter. The document includes mini exercises to reinforce learning through practical application.

Uploaded by

petergoel1705
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Java Programming Notes - Beginner to Pro Level

Week 1: Introduction to Java & Setup

What is Java?
Java is a high-level, object-oriented, and platform-independent programming language. It was developed by Sun
Microsystems in 1995 and is now owned by Oracle. Java applications are compiled into bytecode which runs on the
Java Virtual Machine (JVM), making them portable across platforms.

Why Use Java?


- Platform independence (Write Once, Run Anywhere)
- Robust memory management
- Rich standard libraries
- Widely used in industry (banking, Android apps, etc.)

Java Development Tools


- JDK: Java Development Kit (includes compiler and tools)
- JRE: Java Runtime Environment (includes JVM and libraries)
- JVM: Executes Java bytecode

How Java Code Runs


1. Write code in .java file
2. Compile using 'javac' to create .class file (bytecode)
3. JVM interprets bytecode and runs the program

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

Common Mistakes
- Forgetting semicolons
- Mismatched class/file name
- Wrong method signature for main()

Mini Exercise
Create a file HelloWorld.java. Write a program that prints your name. Compile and run it using terminal or IDE.

Week 2: Variables, Data Types, and Operators

Definition
Variables are containers for storing data values. Java is statically typed, so you must declare the variable type.
Java Programming Notes - Beginner to Pro Level

Data Types
Primitive types include:
- int: whole numbers
- double: decimals
- char: single characters
- boolean: true/false
- byte, short, long, float for specific use cases

Variable Declaration
Syntax:
int age = 25;
String name = "Alice";

Operators
- Arithmetic: +, -, *, /, %
- Relational: ==, !=, >, <, >=, <=
- Logical: &&, ||, !

Common Mistakes
- Using uninitialized variables
- Type mismatch (e.g., int with string)

Mini Exercise
Declare variables for your name, age, and grade. Print them using System.out.println. Try using arithmetic operators.

You might also like