Java Programming Notes
Java Programming Notes
1. Introduction to Java
Java is a high-level, class-based, object-oriented programming language that is designed to have as few
Example:
System.out.println("Hello, World!");
Java supports several data types like int, float, double, char, boolean, etc.
Example:
3. Control Statements
Java has control statements like if, if-else, switch, for, while, and do-while.
Example:
if(number > 0) {
System.out.println("Positive number");
4. Object-Oriented Programming
Java supports OOP concepts: Class, Object, Inheritance, Polymorphism, Encapsulation, and Abstraction.
Example:
class Animal {
void sound() {
System.out.println("Animal sound");
void sound() {
System.out.println("Bark");
Example:
Java Programming Notes
6. Exception Handling
Exception handling in Java is managed via try, catch, throw, throws, and finally.
Example:
try {
int result = 10 / 0;
} catch (ArithmeticException e) {
7. File Handling
Example:
writer.write("Hello File");
writer.close();
8. Collections Framework
Example:
list.add("Apple");
list.add("Banana");
9. Multithreading
Example:
System.out.println("Thread running");
Java 8 introduced features like Lambda expressions, Stream API, Functional interfaces.
Example: