Back to Course
Core Java

Java Classes

What is a Class?

A class is a blueprint that defines the properties (fields) and behaviors (methods) that its objects will have.

public class User {
    String name;
    int age;

    void greet() {
        System.out.println("Hi, I'm " + name);
    }
}

Creating an Object

An object is an instance of a class, created with the new keyword: User u = new User();

Ready to master real-world software testing?

Learn manual and automation testing hands-on with mentor-led sessions.

Explore Course