TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Java

Object Oriented Principles

Overview

Java is an object-oriented programming language. The key principles of object-oriented programming are

  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

Abstraction

Abstraction is hiding implementation details or managing complexity at the system level. For example, when we think of a car, we think of a well-defined object with states and behavior. While driving a car we ignore many internal details of the car like engine, gear system, brake system, etc. We manage the complexity of the car through abstractions. Abstractions allow us to shield with inevitable changes in the subsystems.

Encapsulation

Encapsulation is the binding of data and the methods that operate on the data. For example, you can make a method that changes a variable as private. This keeps the data safe from outside misuse of the data. Encapsulation is at the object level hiding data from outside the class.
Encapsulation acts like a protective shield that prevents code and data from outside interference. Access will be allowed through a well-defined interface. In the Java class, we have variables and methods.

Inheritance

Inheritance is that one object called a subclass or child class acquires or inherits state and behavior from another object called the superclass or parent class. The child class and the parent class share an “IS-A” relationship. For example, the Cat is an animal. In Java, we use the extends keyword to use inheritance.

public Cat extends Pet {
…
}

 

Polymorphism

Polymorphism means having many forms and shapes. Java supports static as well as dynamic Polymorphism. It has the ability to process multiple objects of various classes through a single interface. Any object in Java is polymorphic in nature. We will discuss more static and dynamic polymorphism in detail in another post.

—

Java Tutorials

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/in/java/

Related Posts

Download Greenfoot Windows

Java /

Download & Install Greenfoot on Windows

Java /

Java Static Code Analysis

Java /

Java Testing Tools

Java /

Handle Multiple Exceptions in Java

Exceptions_In_Java

Java /

Exceptions in Java Programs

‹ Java Nested classes› Java Classes and Objects

Recent Posts

  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • RAPTOR Editions
  • Flowgorithm Conditional Breakpoint Statement
  • Flowgorithm Read Numbers from File Example
  • Search Text File Flowchart Example
  • Flowgorithm Turtle Graphics Symbols
  • Draw Circle using Flowgorithm Turtle
  • Draw Parallel Lines using Flowgorithm Graphics

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version