Hey there so it's day 3 of the learning journey and as in my previous post, I mentioned some of the features of Java while closing that post. In this, we are gonna take some of those features that made Java as we know it today.
- at the heart of Java is this paradigm that made it one of the most sought after programming languages in the list of programmers and developers.
- as we all know, before the advent of Java and this paradigm of programming, mostly all the programs were structured in nature. With time, they exceeded that approach where the structured programming was no longer useful.
- in the object-oriented approach the programs are organized around data that is we make it clear in our program that how that data is defined and what changes and modifications can be made to that data and it follows somewhat is close to real-life hierarchies.
- it is based on the concept of the objects.
- contains data in the form of fields also called attributes or properties
- contains code in the form of procedures also known as methods.
- methods of an object with fields and objects interact with other objects.
- this object-oriented model had three major traits that got adopted by Java namely encapsulation, polymorphism and inheritance and became a major part.
- encapsulation in a general sense means to inclose something within a capsule and similarly, it is with the object-oriented model and Java.
- it is a way to bind our code and data on which it operates in such a way that their misuse can be reduced by external factors.
- in Java basic unit of encapsulation is a class, as we said that object are instances of a class so conversely, we can take from that class can be thought as a set of rules specifying how to build that object and while creating those objects we can make sure which other classes can modify and make alterations to the object which we have created in a class.
- polymorphism has originated from Greek words 'poly' meaning many and 'morphe' meaning forms, that is to perform a single task with different inputs you don't need to repeatedly make structures to perform that task all you need is to define a general structure for how that task is to be performed.
- for Java generally the polymorphism is expressed by the phrase " one interface, multiple methods".
- we all must have heard this word in our biology classes haven't we and you can say this concept of object-oriented paradigm was taken from there, in biology inheritance means passing down certain genetic traits from parents to their offsprings.
- in the case of Java and object-oriented programming it can be understood as the process by which one object can acquire the properties of another object, as we know that the object-oriented paradigm is based on hierarchical classification this feature furthermore supports that; an object will just need to define those qualities that make it unique within its class it's other properties that are preceded by its preceding class can be accessed and reused by using this feature of inheritance.
Closing for the day, I will like to hear from your side my readers too for any improvements or suggestions.