0% found this document useful (0 votes)
14 views2 pages

Java Programming Notes 2025

The document provides an overview of Java programming, detailing its key features, basic structure, syntax rules, data types, and control structures. It covers object-oriented programming concepts, exception handling, input/output operations, file handling, and advanced topics like packages and JDBC. This edition serves as a comprehensive guide for understanding and utilizing Java effectively.

Uploaded by

franciskhaoya13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Java Programming Notes 2025

The document provides an overview of Java programming, detailing its key features, basic structure, syntax rules, data types, and control structures. It covers object-oriented programming concepts, exception handling, input/output operations, file handling, and advanced topics like packages and JDBC. This edition serves as a comprehensive guide for understanding and utilizing Java effectively.

Uploaded by

franciskhaoya13
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

JAVA PROGRAMMING NOTES (2025 Edition)

Introduction to Java
Java is a high-level, object-oriented programming language developed by Sun Microsystems (now
owned by Oracle) in 1995. Key Features: - Platform Independent (Write Once, Run Anywhere) -
Object-Oriented - Secure and Robust - Simple and Familiar Syntax - Multithreaded and Portable -
Automatic Memory Management (Garbage Collection) Java Editions: - JSE – Java Standard Edition
- JEE – Java Enterprise Edition - JME – Java Micro Edition

Basic Structure of a Java Program


class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }
Explanation: - class: Defines a class - public static void main(String[] args): Entry point of every
Java program - System.out.println(): Displays text on the screen

Java Syntax Rules


- Java is case-sensitive. - Every statement ends with a semicolon (;). - Curly braces { } define
blocks of code. - Class names start with capital letters (e.g., Student). - Method names start with
lowercase (e.g., getName()).

Data Types in Java


Primitive Types: byte, short, int, long, float, double, char, boolean Non-Primitive Types: Strings,
Arrays, Classes, Interfaces

Variables and Operators


Variable Declaration: int age = 25; double salary = 45000.50; Operators: - Arithmetic: + - * / % -
Relational: == != > < >= <= - Logical: && || ! - Assignment: = += -= *= /=

Control Structures
IF-ELSE Example: if (age >= 18) { System.out.println("Adult"); } else { System.out.println("Minor"); }
FOR Loop Example: for(int i=1; i<=5; i++) { System.out.println(i); }

Object-Oriented Programming (OOP)


Core Concepts: 1. Class – Blueprint for objects 2. Object – Instance of a class 3. Encapsulation –
Hiding data using getters/setters 4. Inheritance – Acquiring properties from another class (extends)
5. Polymorphism – One interface, many implementations 6. Abstraction – Hiding complex details
from the user

Arrays in Java
int[] numbers = {10, 20, 30, 40}; for(int n : numbers) { System.out.println(n); }
Exception Handling
try { int a = 10 / 0; } catch (ArithmeticException e) { System.out.println("Error: Division by zero!"); }
finally { System.out.println("Program ended."); }

Input and Output


import java.util.Scanner; Scanner sc = new Scanner(System.in); System.out.print("Enter name: ");
String name = sc.nextLine(); System.out.println("Hello, " + name);

File Handling
import java.io.FileWriter; import java.io.FileReader; FileWriter writer = new FileWriter("data.txt");
writer.write("Hello Java!"); writer.close(); FileReader reader = new FileReader("data.txt"); int ch;
while((ch = reader.read()) != -1) System.out.print((char)ch); reader.close();

Advanced Concepts
- Packages – Group related classes (package student;) - Interfaces – Define methods without
implementation - Threads – Used for multitasking - JDBC – Java Database Connectivity - Applets &
GUI – Building graphical interfaces

You might also like