24
Core Concepts behind Java OOP
I am reviewing for an Oracle Java Certification exam and decided to run through the documentation of Java's Nuts and Bolts. Check out the github repository for other review bullet points. Here are my notes for the core concepts behind Java's object-oriented programming (OOP).
An object is a software bundle of related state and behavior. Software objects are often used to model real-world objects found in everyday life
- Modularity : The source code for an object can be written and maintained independently of the source code for other projects. Once created, an object can be easily passed around inside the system.
- Information Hiding. By interacting only with an object's methods, the details of its internal implementaion remain hidden from the outside world.
- Code reuse : If an object already exists (might have been written by another programmer), that can be used in the program. This allows specialists to implement/test/debug complex, task-specific objects, which can then be trusted in your own code.
- Pluggability and Debugging Ease . If a particular object turns out to be problematic, it can simply be removed from the application and plug in a different object as a replacement. Similar to fixing a mechanical problem in the real world, if a bolt breaks, it can be replaced, but not the entire machine.
A class is a blueprint or prototype from which objects are created.
class
is the blueprint from which individual objects are created.Inheritance provides a powerful and natural mechanism for organizing and structuring software.
An interface is a contract between a class and the outside world. When a class implements an interface, it promises to provide the behavior published by that interface.
A package is a namespace for organizing classes and interfaces in a logical manner. Placing code into packages makes large software projects easier to manage.
NOTE: These questions are the review questions in the Java documentation.
extends
keyword.
24