Java OOP

    

        OOP sands for Object-Oriented Programming 

 

Procedural Programming -: Writing procedures or methods that performs operations on data.

Object-Oriented Programming -: Creating objects that contains both data & methods


Advantages of object-oriented programming over procedural programming -:

  • faster & easier to execute
  • provide the clear structure for the programs
  • keep DRY "Don't repeat yourself" principle, and makes the code easier to maintain, modify & debug.
  • possible to create less reusable application with less code & shorter development time

 

Classes & Objects 

Classes and objects are the two main aspects of object-oriented programming. 

Look following examples to get idea about classes & objects -:

ex 1-:

class - fruit

objects -: Apple, Banana, Mango


ex2-:

class-: Animal

objects -: Dog, Cat, Monkey


class is a template for object. object is an instance of a class.

When the individual objects are created, they inherit all the variables and methods from the class.

 

Like to introduce more details about classes and objects in the next post

Comments

Popular posts from this blog

Create your first Java program

Java Variables