Introduction to Object Oriented Programming Concepts

BASIC, C, C++ and Java are popular examples of high-level languages.

Procedural Oriented Programming (POP)

POP allows the users to develop their logic by applying a number of functions that would enable program productivity.

In POP, the emphasis is on functions rather than on data.

POP uses a top-down approach of programming.

BASIC, COBOL, FORTRAN and C are Procedure Oriented Programming Languages.

Object Oriented Programming (OOP)

OOP follows a modular approach to standardize the program by creating a memory area for both data and functions.

In OOP, emphasis is on data rather than functions.

OOP uses a bottom-up approach of programming.

C++, Java, Python, Smalltalk, Ruby, Eiffel are Object Oriented Programming Languages.

Objects

It is a unique identity which contains data and functions together.

Class

It is a template of objects. It contains common attributes and behavior.

Principles of OOP

Data Abstraction

It is the act of representing the essential features without knowing the background details.

Inheritance

It is about linking and sharing some common properties of one class with the other class. It lets us reuse code.

Polymorphism

It is the process of using a function or method for more than one purpose. Function Overloading is an example of polymorphism.

Encapsulation

It is the system of wrapping data and functions into a single unit.

Exercise Questions

Fill in the blanks:

  1. An act of using essential features without including background details is called data abstraction.
  2. In Object Oriented Programming, the stress is given on data.
  3. Wrapping of data and functions together as a single unit is called encapsulation.
  4. An object has unique identity through which it may differ with some characteristics and behavior.
  5. The objects may communicate with each other through functions.
  6. In POP, the global data is loosely attached to the functions.
  7. The process by which a class acquires the property of another class is known as inheritance.
  8. In Object Oriented Programming, using a function for many purposes is termed as polymorphism.

State whether True or False:

  1. A process according to which a class acquires the characteristics from another class is encapsulation. (FALSE)
  2. Procedure Oriented Program stresses on data. (FALSE)
  3. C++ is also an object-oriented programming language. (TRUE)
  4. A function is a set of objects that share common state and behavior. (FALSE)
  5. Encapsulation keeps data safe from outside interference. (TRUE)

Introduction to Java

Java is an object-oriented programming language. It was developed primarily by James Gosling at Sun Microsystems. The language was initially called Oak.

Java is a platform independent language. It has adopted many of its features from C++.

Basic Features of Java

  • Java is an object-oriented programming language.
  • It is both compiled and interpreted.
  • It can access data from local system as well as from net.
  • Java programs are written within classes.
  • We can create applets using Java.
  • Java doesn’t require any preprocessor.
  • It is case-sensitive.

Compilers and Interpreters

A software that accepts the whole program in high level language and converts it into machine level language is known as a compiler.

A software that converts the high level instructions line by line to machine level language is known as an interpreter.

Compilers are usually faster than interpreters.

The program that the compiler uses for conversion is called source program or source code.

The machine language program that we get from the compiler is called object code.

Compilers are incapable of showing logical errors.

Compilers and interpreters are system software, and are together known as language processors.

Java compiler is a software that converts source code into intermediate binary form called bytecode. This bytecode is platform independent.

The Java interpreter converts bytecode into machine code. This Java interpreter is also known as JVM (Java Virtual Machine).

A package can be included in the program by using the keyword import.

java.lang is the default package in Java.

Java Reserved Words

Java reserved words or keywords are the words which carry special meaning to the Java compiler. They cannot be used for naming the variables.

Different Types of Java Programming

There are mainly two different platforms for writing Java programs:

  • Java Application
  • Java Applets

Java Application (Standalone System)

Java can be used to create standalone desktop applications.

Java Applets (Internet Applets)

It is a program that can be included in an HTML page.

JDK stands for Java Development Kit.

Exercise Questions

Write True or False:

  1. Java application is a Java program which is developed by users. (FALSE)
  2. James Gosling developed Java programming language. (TRUE)
  3. Machine codes are expressed using alphanumeric characters. (FALSE)
  4. Bytecode is the program in binary form. (TRUE)
  5. JVM is Java Visual Management. (FALSE)

Fill in the blanks:

  1. Java is a case-sensitive language.
  2. In Java, the package used to find power raised to any base is java.lang.
  3. The words which are preserved with the system are called reserved words, that cannot be used as variable names in Java programming.
  4. A single line comment is represented by the symbol // in Java programming.
  5. BlueJ is a window based platform to operate Java program.

14 thoughts on “Introduction to Object Oriented Programming Concepts”

    • COBOL – Common Business Oriented Language.
      FORTRAN – Formula Translator
      Function Overloading is an example of polymorphism. It is about having same function, doing different types of tasks based on the values passed to it.

Leave a Reply

%d bloggers like this: