Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

ReadMe.md

Classes & Objects

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.

Topics Covered:

  1. Classes & Objects - Defining and using classes and objects.
  2. Constructors - Default and parameterized constructors.
  3. Methods - Creating methods and method overloading.
  4. Static Keyword - Using static variables and static blocks.

Example Programs:

  • 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.

Exercises:

  1. Create a class Box and calculate its volume.
  2. Create a class Triangle and calculate its area using a parameterized constructor.
  3. Write a program to demonstrate static variables and methods.

Once you grasp OOP basics, move on to Inheritance & Polymorphism.


Files

  • 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.