100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

Object Oriented Programming

Rating
-
Sold
-
Pages
4
Uploaded on
16-06-2021
Written in
2020/2021

A class is therefore set of attributes put together in one container or capsule. This process of putting together attributes and methods (behavior) is called Encapsulation.

Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Connected book

Written for

Institution
Course

Document information

Uploaded on
June 16, 2021
Number of pages
4
Written in
2020/2021
Type
Class notes
Professor(s)
Dr simba
Contains
All classes

Subjects

Content preview

CSI21M1 Java Programming Notes, prepared by Mr. S. Nyika, Semester I, 2019


Lecture 1: Object Oriented Programming

Objectives:
At the end of this lecture, students will be able to:
• explain the important principles of Object Oriented Programming
• define the term class
• define the term object
• explain the relationship between a class and its objects
• understand that there are two kinds of programmers
• explain why class programmers need to hide data
• advantages of Object Oriented Programming as opposed to linear programming
• Write a class in java syntax
Notes:

A class in Java is the same as a class in C++. It has attributes and behaviour which are put together as
one unit. This unit is called a class. A class is therefore set of attributes put together in one container or
capsule. This process of putting together attributes and methods (behaviour) is called Encapsulation.

An example is the car. When this is taken as a class will therefore appear with attributes and methods or
functions. There are three principles which are used to make sure the class is well formed. These are
Encapsulation, Polymorphism and Inheritance. Encapsulation is the bundling together the attributes
and the methods as follows:

class Car
{
String carModel;
int engineNumber;
int yearManufatured;
void setCarModel(String model)
{
carModel=mode;
}
void setEngineNumber(int enumber)
{
engineNumber=enumber;
}
void setYearManufactured(int year)
{
yearManufatured=year;
}
String getCarModel()
{
return carModel;
}
int getEngineNumber()
{
return engineNumber;
}
int getYearManufactured()
{
return yearManufatured;
}
}


Page 1 of 4
$3.11
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
keanuperumal

Get to know the seller

Seller avatar
keanuperumal Walter Sisulu University
Follow You need to be logged in order to follow users or courses
Sold
1
Member since
4 year
Number of followers
1
Documents
10
Last sold
4 year ago

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions