java poo
java poo
I-INTRODUCTION TO OOP
Definition
Attributes: These are the variables that define the properties of the
object. For example, a Car class might have attributes like color, model,
and year.
Methods: These are the functions that define the behavior of the object.
For example, a Car class might have methods like start(), stop(), and
accelerate().
When the individual objects are created, they inherit all the variables and
methods from the class.
In this part we are going to unified how a class can be medelise. So that if
I’m working in a companie and i modelise class and object to create a
software. And if leave the companie. If another software engeneer join
the compagnie he be able to understand what I was modelising.
Class Attributes:
Attributes are shown in the second partition.
The attribute type is shown after the colon.
Attributes map onto member variables (data members) in code.
Class Visibility
The +, - and # symbols before an attribute and operation name in a class
denote the visibility of the attribute and operation.
int x = 5;
System.out.println(myObj.x);