Skip to content
  • Facebook
GeekCer Logo

GeekCer

The geek's Coding education and Review centre

  • Home
  • Tutorials
    • Java
    • Servlet
    • JSP
    • Python
    • C Tutorial
    • Spring
    • Spring Boot
    • MongoDB
    • Hibernate
    • Data Structure
  • General Knowledge
  • Biography
  • Grammar
  • Festival (त्योहार)
  • Interview
  • Differences
  • Important
  • Toggle search form

Home » Java » Object Oriented Programming

  • Ganesh Chaturthi Puja in Hindi | गणेश चतुर्थी का व्रत, महत्व, कथा
    Ganesh Chaturthi Puja in Hindi | गणेश चतुर्थी का व्रत, महत्व, कथा Festival
  • Christmas Day Celebration
    Christmas Day Celebration | Story about Christmas day Festival
  • Kapil Sharma Show, Comedy Show in Hindi
    Kapil Sharma Show, Comedy Show in Hindi Biography
  • Human rights day
    Human rights day in Hindi: 10 दिसंबर ह्यूमन राइट्स डे General Knowledge
  • What is Verb
    What is Verb? Types of Verbs and Examples Grammar
  • Ramayan : Short Story of ramayana in Hindi | Qualities of Rama
    Ramayan : Short Story of ramayana in Hindi | Qualities of Rama Spiritual
  • Fundamental Duties of Indian Citizens
    Fundamental Duties of Indian Citizens | 11 मौलिक कर्तव्य हिंदी में General Knowledge
  • America Independence Day : 4th July USA | USA Birthday
    America Independence Day : 4th July USA | USA Birthday General Knowledge

Object Oriented Programming

Posted on August 15, 2021October 4, 2021 By GeekCer Education No Comments on Object Oriented Programming
Object Oriented Programming

Java is Object Oriented programming language which means java programs use classes and objects. In order to write a program in Java we need atleast a class or an object. A class is a module which contains data and methods to achieve task.

Each class can perform same tasks for which we write methods in a class. This approach is called Object Oriented approach. An object oriented approach is a methodology by which we can complete tasks in a better way in programming language.

This approach is built from “objects”, which represent anything that exists in the real world. For example, all animals are objects, all humans are objects. So we use this approach in programming then it is called OOPs.

In OOP concept, you design a computer program and create objects to interact with each other.

Table of Contents

  • What is the need for Object Oriented programming?
  • Features of Object Oriented Programming
    • 1) Class and Object
    • 2) Abstraction
    • 3) Encapsulation
    • 4) Inheritance
        • Syntax of Java Inheritance
    • 5) Polymorphism
  • Advantages of Object Oriented Programming

What is the need for Object Oriented programming?

We prefer object oriented programming because of following reasons:

  • Software is easy to understand if you develop using OOPS concept.
  • The readability, understandability, and maintainability of the code increase.
  • If you are going to develop big software then you should prefer oops concept which is easy to write and manage.

Java, C++, Javascript, Python, PHP are the example of major Object-Oriented Programming languages.

Features of Object Oriented Programming

The main features related to OOP are as follows:

  1. Class and Object
  2. Abstraction
  3. Encapsulation
  4. Inheritance
  5. Polymorphism

Let’s discuss all the feature of object oriented approach in details one by one.

1) Class and Object

Class is a model for creating objects and it defines shape and behavior of an object and describes the properties and actions. In other words, a class represents a group name given to several objects that have similar properties and actions.

In short, an object is anything that actually exists in the world. If we consider a program then and object is an instance of class which has properties and performs specific actions.


public class Main {  // Class Name
 private int var1;
 public int getVar1() {  // Getter Method
  return var1;
 }
 pubilc void setVar1(int var1) { // Setter Method
  this.var1 = var1;
 }
}

2) Abstraction

A class may contain a lot of data that is not useful to the user, the user may only need some part of the available data. In this case, you can hide unnecessary data from the user and present only the data that is of interest to the user.

So Abstraction is the process of hiding unnecessary information and showing only essential details to the user.

3) Encapsulation

In encapsulation is a process in which we bind all variables/data and methods together in a single unit. For example, we write the variables and methods inside the class that means we are binding them together.

Encapsulation separates the members of one class from the members of another class hence each object shares different memory. This concept helps the programmers to use the same name for members in different classes.

4) Inheritance

Inheritance is a concept of creating new classes from existing classes, so the newly created class acquire all the features of the existing classes.

A super class may have one or more sub classes but a subclass can have only one super class. And we use java extends keyword to inherit other class.

Syntax of Java Inheritance
               
 public class <sub-class> extends <super-class> {  
    // Class body 
 }

5) Polymorphism

Polymorphism provides the flexibility in writing programs in such a way that the programmer can use same method call to perform different operations, so we can say that a programmer reuse the code for different purpose.
There are two types of polymorphism in object oriented language:

  • Compile-time polymorphism
  • Runtime polymorphism

Advantages of Object Oriented Programming

There are many benefits of using OOP concept which are as follow:

  • Simple and clear structure of OOP program.
  • Code reusability
  • Partitioning in OOPs project work is very easy.
  • Faster and easier execution.
  • Due to message passing technique, the communication between objects are easy.
  • Flexibility in Polymorphism and easy troubleshooting.
  • You can save lots of time to maintain and modify the existing codes, on the other hand you can save lots of cost.

In conclusion, if you have come to know about the JDBC driver then your next step should be the Java connectivity with the database. Hope you liked the article on JDBC Driver in Java. Feel free to contact geekcer.code@gmail.com or you can write a comment if you have any doubts and questions.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • More
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Also Read

Java

Post navigation

Previous Post: Method Overloading in Java
Next Post: Collections in Java

More Related Articles

Variables in Java Variables in Java Java
Java LinkedList Java LinkedList Java
Iterate Map in Java Iterate Map in Java, Map.entrySet(), Iterators, foreach Loop Java
Difference between final, finally and finalize Difference between final, finally and finalize Differences
Java Switch Case Java Switch Case : Switch fall-through, default, break, examples Java
Data Types in Java Data Types in Java Java

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Java Home
  • Java Comments
  • Java Variables
  • Java Data Types
  • Java Keywords
  • Java Operators
  • Java If-else Statement
  • Java Switch
  • Java Loop
  • Java Arrays
  • Method Overloading in Java
  • Java OOP
  • Java Collections
  • Java ArrayList
  • Java LinkedList
  • Java Vector
  • Multithreading in java
  • Thread Synchronization
  • Exception Handling
  • Java JDBC Driver
  • Java Database Connectivity steps
  • Lambda Expressions
  • Concurrent Collections
  • National Farmers Day in Hindi | राष्ट्रीय किसान दिवस पर निबंध | चौधरी चरण सिंह जयंती
  • Human rights day in Hindi: 10 दिसंबर ह्यूमन राइट्स डे
  • Unicef day is celebrated on December 11 | Speech on unicef day
  • Indian Navy Day: जल सेना दिवस कब और क्यों मनाया जाता है?
  • P V Sindhu Biography in Hindi, Badminton, State, Caste पी. वी. सिंधु जीवन परिचय, कहानी, राज्य, जाति
  • Draupadi Murmu Biography In Hindi | द्रौपदी मुर्मू की जीवनी
  • TCP/IP Model, Full Form, Layers and their Functions
    TCP/IP Model, Full Form, Layers and their Functions Networking
  • Difference between Internet and Intranet
    Difference between Internet and Intranet Differences
  • Network kya hai (नेटवर्क क्या है)
    Network kya hai (नेटवर्क क्या है) Networking
  • Similarities and difference between OSI and TCP/IP model
    OSI vs TCP/IP Model, Similarities and difference between OSI and TCP/IP model Networking
  • OSI Model | 7 Layers of OSI Model in Computer network
    OSI Model | 7 Layers of OSI Model in Computer network, Functions Networking
  • Difference between TCP and UDP
    Difference between TCP and UDP | TCP vs UDP examples Differences
  • IPv4 Vs IPv6 | Difference between IPv4 and IPv6
    IPv4 Vs IPv6 | Difference between IPv4 and IPv6 Differences
  • Java Tutorial
  • Servlet Tutorial
  • JSP Tutorial
  • Maven Tutorial
  • HTML Tutorial
  • Programs
  • Hindi/English Grammar
  • Difference Between ... and ...
  • HR Interview
  • Important Articles

Write to Us:
geekcer.code@gmail.com

  • About Us
  • Privacy and Policy
  • Disclaimer
  • Contact Us
  • Sitemap

Copyright © GeekCer 2022 All Rights reserved