Java Programming Notes
Introduction to Java
Java is a high-level, class-based, object-oriented programming language designed to have as few
implementation dependencies as possible. It is widely used for building cross-platform applications.
Basic Syntax
- Case-sensitive language - Class names should start with uppercase - Source file name must match
the public class name - The main method: public static void main(String[] args)
Data Types in Java
Primitive Data Types: - byte, short, int, long - float, double - char, boolean Non-Primitive Data Types: -
String, Arrays, Classes, Interfaces
Control Statements
- if, if-else, nested if - switch-case - loops: for, while, do-while - break and continue
Object-Oriented Programming Concepts
- Class and Object - Inheritance - Polymorphism - Abstraction - Encapsulation
Exception Handling
Java provides a robust mechanism to handle runtime errors using: - try, catch, finally - throw and
throws - user-defined exceptions
Java Libraries
Commonly used packages: - java.util - java.io - java.net - java.sql - java.time
Conclusion
Java remains one of the most popular programming languages in the world, used in web, mobile,
desktop, and enterprise applications.