Java Programming - Advanced

Posted By: ELK1nG

Java Programming - Advanced
English | 2021 | ASIN: B09N1QRH7S | 28 pages | PDF,EPUB,AZW3 | 740 KB

<b>OBJECT ORIENTED PROGRAMMING</b><br><br>Java's core is object-oriented programming (OOP). All Java programs are, in fact, at least partially object-oriented. OOP is an integral part of Java. It is important to be familiar with its principles before you start writing simple Java programs.

<b>OBJECT ORIENTED PROGRAMMING</b><br><br>Java's core is object-oriented programming (OOP). All Java programs are, in fact, at least partially object-oriented. OOP is an integral part of Java. It is important to be familiar with its principles before you start writing simple Java programs. This chapter will discuss the theoretical aspects and applications of OOP.<br><br><b>TWO PARADIGMS</b><br><br>Computer programs are composed of code and data. A program can also be conceptually organized around either its code or its data. This means that some programs are written around what is happening, while others are written around who is being affected. These two paradigms govern how programs are constructed. The process-oriented model is the first. This model describes a program in a series or steps (that is code). This model is code that acts on data. This model is used to great effect in procedural languages like C.<br><br><b>ABSTRAACTION</b><br><br>Abstraction is an essential component of object-oriented programming. Abstraction is how humans manage complexity. People don't think of a car, for example, as a collection of thousands of parts. It is a clearly defined object that has its own behavior. This abstraction allows people the freedom to drive a car to the grocery without worrying about the intricate parts. They don't have to pay attention to the intricate details of the engine, transmission, or braking system. They can instead use the entire object.<br><br><b>ENCAPSULATION</b><br><br>Encapsulation is a mechanism that binds code and data together and protects them from misuse and interference. Encapsulation can be described as a protective wrapper that blocks code and data being accessed by code outside of the wrapper. The interface that controls access to code and data within the wrapper is well-defined. This is analogous to an automobile's automatic transmission. This information contains hundreds of bits about your engine. It includes the amount of acceleration, pitch of the surface, and position of the shift lever.<br><br><b>POLYMORPHISM AND ENCAPSULATION WORK TOGETHER</b><br><br>Polymorphism, inheritance, and encapsulation can be combined to create a programming environment that is far more robust than the process-oriented model. The basis for reuse of the code you have spent time developing and testing is a well-designed hierarchy. Encapsulation makes it possible to move your implementations without breaking any code that relies on your public interface. Polymorphism allows for the creation of clean, sensible, readable and resilient code.<br><br><b>THE FIRST SIMPLE PROGRAM</b><br><br>Let's now look at actual Java programs after we have covered the basics of Java object-oriented underpinnings. Let's begin by running and compiling the following sample program. This takes a bit more effort than you might think.<br>