Skip to content

Module 1 Introduction to Object Oriented Programming

01/22/2026

Tag: #java


Functions

- The group of codes or statements that performs one task

Types of Functions

  • Methods written by the programmer.

a) Method with No Parameters & No Return Value

1
2
3
void greet(){     
    System.out.println("Hello!"); 
}

b) Method with Parameters & No Return Value

1
2
3
void greetUser(String name) {
    System.out.println("Hello " + name); 
}

c) Method with Return Value & No Parameters

1
2
3
int getNumber() {
     return 10; 
}

d) Method with Parameters & Return Value

1
2
3
int add(int a, int b) {     
    return a + b; 
}

Objects

  • Used to represent real-world entities in the program
  • Characteristics
  • Actions
  • Properties / Attributes
  • Methods

Case Scenario:

  • Parking space
  • Condominium Car parking system
  • Object: Car / Attributes: Vehicle type , Owner's name , OR CR data, Rental fee , Rental type , Parking ticket id,
  • Methods and Action: park in / park out (requried attribute : Plate number , date , )

First Create is Class

  • Class - The blueprint of the object .
  • Class is define and structor Object .
  • Templated Object.

image1