Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Easy to learn

Rating
-
Sold
-
Pages
30
Uploaded on
25-05-2023
Written in
2022/2023

Very very useful notes

Institution
Course

Content preview

UNIT I INTRODUCTION TO OOP AND JAVA FUNDAMENTALS 10

Object Oriented Programming - Abstraction – objects and classes - Encapsulation- Inheritance -
Polymorphism- OOP in Java – Characteristics of Java – The Java Environment - Java Source File -Structure
– Compilation. Fundamental Programming Structures in Java – Defining classes in Java – constructors,
methods -access specifiers - static members -Comments, Data Types, Variables, Operators, Control Flow,
Arrays , Packages - JavaDoc comments.

OOPs (Object Oriented Programming System)
Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is
a methodology or paradigm to design a program using classes and objects. It simplifies the
software development and maintenance by providing some concepts:

o Object
o Class
o Inheritance
o Polymorphism
o Abstraction
o Encapsulation

In this page, we will learn about java objects and classes. In object-oriented programming technique, we
design a program using objects and classes.

Object is the physical as well as logical entity whereas class is the logical entity only.

Object in Java
An entity that has state and behavior is known as an object e.g. chair, bike, marker, pen,
table, car etc. It can be physical or logical (tangible and intangible). The example of
intangible object is banking system.

An object has three characteristics:

o state: represents data (value) of an object.

o behavior: represents the behavior (functionality) of an object such as deposit,
withdraw etc.
o identity: Object identity is typically implemented via a unique ID. The value of the
ID is not visible to the external user. But, it is used internally by the JVM to identify
each object uniquely.

Class in Java

A class is a group of objects which have common properties. It is a template or blueprint
from which objects are created. It is a logical entity. It can't be physical. A class in Java can
contain:

, o fields

o methods

o constructors

o blocks

o nested class and interface


Inheritance in Java

Inheritance in java is a mechanism in which one object acquires all the properties and
behaviors of parent object. It is an important part of OOPs (Object Oriented programming
system).

The idea behind inheritance in java is that you can create new classes that are built upon
existing classes. When you inherit from an existing class, you can reuse methods and fields
of parent class. Moreover, you can add new methods and fields in your current class also.

Types of inheritance in java

On the basis of class, there can be three types of inheritance in java: single, multilevel and
hierarchical.

In java programming, multiple and hybrid inheritance is supported through interface only.
We will learn about interfaces later.

, Polymorphism in Java

Polymorphism in java is a concept by which we can perform a single action by different
ways. Polymorphism is derived from 2 greek words: poly and morphs. The word "poly"
means many and "morphs" means forms. So polymorphism means many forms.

There are two types of polymorphism in java: compile time polymorphism and runtime
polymorphism. We can perform polymorphism in java by method overloading and method
overriding.

If you overload static method in java, it is the example of compile time polymorphism. Here,
we will focus on runtime polymorphism in java.

Runtime Polymorphism in Java

Runtime polymorphism or Dynamic Method Dispatch is a process in which a call to an
overridden method is resolved at runtime rather than compile-time.

In this process, an overridden method is called through the reference variable of a
superclass. The determination of the method to be called is based on the object being
referred to by the reference variable.

Method Overloading in Java

If a class has multiple methods having same name but different in parameters, it is known
as Method Overloading.

If we have to perform only one operation, having same name of the methods increases the
readability of the program.

Suppose you have to perform addition of the given numbers but there can be any number
of arguments, if you write the method such as a(int,int) for two parameters, and
b(int,int,int) for three parameters then it may be difficult for you as well as other
programmers to understand the behavior of the method because its name differs.

Written for

Course

Document information

Uploaded on
May 25, 2023
Number of pages
30
Written in
2022/2023
Type
Class notes
Professor(s)
Rajkumar
Contains
All classes

Subjects

$12.09
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
sakthivel2

Get to know the seller

Seller avatar
sakthivel2 Exam Questions
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions