Basic Concepts
In a nutshell: Classes are blueprints; objects are the things you build from them.
## Introduction to Object-Oriented Programming
Java is an object-oriented language, which means it organizes code around objects and classes.
### What is a Class?
A class is a blueprint for an object. It describes what an object knows (its variables) and what it can do (its methods).
```java
public class Dog {
String name;
int age;
void bark() {
System.out.println("Woof!");
}
}
```
### What is an Object?
An object is an actual thing created from a class. You can make many objects from the same class.
```java
Dog myDog = new Dog();
myDog.name = "Buddy";
myDog.age = 4;
myDog.bark();
```
## Why Use Classes and Objects?
They allow you to organize code, reuse logic, and create complex programs that mirror real-world things.
## Real-World Analogy
A class is like a recipe, and objects are cakes you bake from that recipe!
Examples
- Defining a class called `Car` with variables for `make` and `model`.
- Creating two `Student` objects named `alice` and `bob` from a `Student` class.