Tuesday, March 9, 2021

JAVA Installation and OOPS

 


JAVA INSTALLATION

JAVA can be installed by following the guidance on its official website. Be sure to download the appropriate software that matches the operating system that you are currently using. The link below will provide you with all the available java JDK applications. 

https://www.oracle.com/java/technologies/javase-downloads.html

OBJECT-ORIENTED DESIGN

Object-oriented design is used to overcome the drawbacks of the procedural programming approach. Before this approach, all programs and principles were not close to real-world applications.

In this approach, we define a state and its behavior. Taking an example of the real world, mobile phone is a state and they have different behaviors. Customers are only interested in its features, applications, and handy look. They are not interested in the working of its internal software or hardware used inside it. So in mobile phones, customers have access to a few functionalities or behaviors, the rest of others are hidden from them.

In a similar manner, we can use object-oriented programming to achieve this task easily. State i.e. mobile phone is taken as a class which has different objects i.e. mobile phone which a particular customer is using. Now class will have different behaviors i.e. data attributes and methods. Now each instance of this class can only access only a few behaviors from all behaviors defined in the class. 

Different principles of object-oriented programming are as follows:-

ENCAPSULATION :

It is a mechanism of wrapping data attributes and methods in a class. Each class can have some variables known as data attributes and functions known as methods to provide all relevant behaviors for that class.

INHERITANCE:

It is a mechanism where one class can inherit few properties from a class and can change its implementation as per its own requirement. For Example, if a car is a class then it has the functionality that every car will have 4 wheels, will drive, and have sitting space. But each model of the car will have a different appearance, mileage, price, etc. Still, those different models will have all the functionalities of a car. So these all models will inherit all properties from the parent class and will then change if required or will add their own new functionalities or behavior.

ABSTRACTION:

It is a mechanism of showing only essential or relevant details to users and ignoring the explanation or irrelevant details from them. It is used to reduce the complexity of a program. It helps to provide only the behavior of a particular state and separates its explanation so that code is understandable and is less complex.

In java, Abstract Classes are used to implement this principle. In abstract classes, it can have abstract methods. Abstract methods only have the function declaration and definition is provided by child classes i.e. which has inherited this class. So its explanation is provided in other classes and the abstract class will only have names of all relevant behaviors required.

DATA HIDING:-

It means to hide data from some part of a component. It is used to achieve encapsulation i.e. private data is not accessible outside class or objects of that class. It is used to achieve the functionality that few behaviors are hidden and few are only accessible to users.

POLYMORPHISM:-

It is the mechanism to process the same functionality or task in different ways as per its usage. For Example:- sum method is used to add 2 numbers and also to add 3 numbers. So the name of functionality is the same i.e. some but is performing different operations.

No comments:

Post a Comment

Newbie to Newbie Algorithms and Data Structures

As a newbie myself, I can see how this topic can be a little daunting or even pointless at times. However, understanding how algorithms and ...