• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 4 pages
Class notes

Object Oriented Programming

Document preview thumbnail
Preview 1 out of 4 pages

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.

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

Connected book
 image
Publisher: 2006 ISBN: 9780126339512 Edition: Unknown

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
R51,00

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
1
Followers
1
Items
10
Last sold
5 year ago



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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions