Class Time – Week 2

--Originally published at Jsph's Blog

Class Time – Week 2

 

Today in class we discussed in small groups what is an object, attribute and method.

I’m going to explain briefly what they are

Object: Objects are everything, real-world objects share two characteristics: They all have state and behavior.

“Software objects are conceptually similar to real-world objects: they too consist of state and related behavior. An object stores its state in fields (variables in some programming languages) and exposes its behavior through methods (functions in some programming languages). Methods operate on an object’s internal state and serve as the primary mechanism for object-to-object communication. Hiding internal state and requiring all interaction to be performed through an object’s methods is known as data encapsulation — a fundamental principle of object-oriented programming.”

https://docs.oracle.com/javase/tutorial/java/concepts/object.html

Attribute: These store and specify the information associated with an object. Attributes determine how an object will look and behave. You can define attributes with attribute statements in Class blocks

Method: A method is a procedure associated with a class, it defines the behavior of the objects that are created from the class. Another way to say this is that a method is an action that an object is able to perform.


Class Time – Week 2