Object Oriented Programming

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Object Oriented Programming is an approach to programming that considers objects as fundamental

building blocks of programs.

An Object refers to an instance of a class.

A Class refers to a blueprint from which objects are created.

It should be noted that objects are created from classes.

N.B-Name of a class is always one word.

A class is made of attributes and methods

 Attributes are characteristics of a given class and normally have values.

Example of a class.

Student Class First Y M


(Attributes) Ben Ana Bob
Name
Reg.no U61/4 U10/87 U18/23
Gender M F M
Y.O.B 2010 2006 2000
(Method) () () ()
Calculate Age() } } }
2021-2010 2021-2006 2021-2000
} } }

How to write a program in java.

Public class first program{

//attributes

Public static void main ( String [] arrys ){

System.out.printIn(“ we are “);

System.out.printIn (“ students\n of \n Ndejje “);

}
Declaring variables in java.

Public static int x=10;

Public static String name= “Ben”;

Public static void main(String [] arrys ){

TO OU PUT BEN.

System.out.printIn(x);

System.out.printIn(“ Ben ”);

ASSIGNMENT 1

Languages that are objected oriented E.g …………….

Other languages are ?? E.g………………..

ASSIGNMENT 2

Write 20 classes and create objects from them.

ASSIGNMENT 3

Terms related to objected oriented programming.

(i)Inheritance
(ii)Abstraction
(iii)Polymophism
(iv)Objects
(v)Classes
(vi)Encopsulation

ASSIGNMENT 4
Compilation process of a java program.

ASSIGNMENT 5
Write 5 programs using special characters
ASSIGNMENT 6
Write down common data types in java and use them in a program.

ASSIGNMENT 7
Run one program in java.

You might also like