Now that you have a solid foundation in Java, let's dive into Object-Oriented Programming (OOP). In this section, you'll learn how to create classes and objects, and how to use methods and static variables.
- Classes & Objects - Defining and using classes and objects.
- Constructors - Default and parameterized constructors.
- Methods - Creating methods and method overloading.
- Static Keyword - Using static variables and static blocks.
Box.java- Create a class to calculate the volume of a box.UseStatic.java- Demonstrate the use of static methods, variables, and blocks.TestReference.java- Illustrate passing objects as parameters.
- Create a class
Boxand calculate its volume. - Create a class
Triangleand calculate its area using a parameterized constructor. - Write a program to demonstrate static variables and methods.
Once you grasp OOP basics, move on to Inheritance & Polymorphism.
- Box.java: Demonstrates the creation and use of a simple class.
- TestReference.java: Tests object references and their behavior.
- UseStatic.java: Demonstrates the use of static members.