Network Security
Java is object-oriented programming (OOP) language. OOP languages like Java deal with objects and classes. A class can simply be explained with the use of attributes and behaviors. Using a person as an example, attributes of a person would be their height, weight or eye color. Using the same example, behaviors are actions a person does like eat, run, or sleep. For objects, they are an instance of a class. They are described with characteristics and methods. Characteristics are like attributes, but instead of a person’s height, it gives the height a value like 5’9’’. Methods are like behaviors of a class, they are actions.
There are four principles that you must learn when learning an OOP language. These principles include encapsulation, data abstraction, polymorphism, and inheritance. Encapsulation is used to ensure an object’s integrity. It does this by hiding functional details of a class. With inheritance, a subclass acquires the attributes and behaviors of the parent class. Instead of making multiple classes for one object, you can make subclasses or child classes that inherit the parent classes attributes and behaviors and incorporate more attributes and behaviors for that specific child class. For example, have an “Automobile” parent class and then having “Ford” and “Chevrolet” child classes.
Polymorphism is similar to inheritance, but a child class can also modify the parent class’s behavior to get a different output or result. Data abstraction, the simplest explanation is one that I have read from Raymondlewallen (2005), “data abstraction is the development of classes, objects, types in terms of their interfaces and functionality” (para. 5).
References
Curry, C. (2018, Nov 28). Java Tutorials [Video File]. Retrieved from
Java Programming Tutorial 1 - Introduction to Java (Links to an external site.)
Java Programming Tutorial 1 - Introduction to Java
Comments
Post a Comment