16
Most read
18
Most read
21
Most read
BY
N.RUBA
ASST.PROF/DEPT. OF CA,
BON SECOURS COLLEGE FOR WOMEN,
THANJAVUR.
 JAVA - A general purpose, high-
level, object-oriented, cross-
platform programming language developed
by James Gosling at Sun Microsystems in
1995.
 In structured programming, a complex
program is broken into sets of smaller,
understandable tasks; but it is very hard to
maintain.
 Introduction to oop
◦ A procedure is defined as a collection of
instruction executed in sequential order.
 Oops concept was introduced by Xerox
Corporation in early 1970s.
 The first object oriented language was
Smalltalk.
 Oops languages: C++,Java and Eiffel.
 Objects and Classes are building blocks of
OOP.
 Object is a Programming entity in OOP.
◦ It has data components representing the present
state of the object as well as functions also called
methods.
 Object contains
◦ Attributes- data associated with the object
◦ Methods-functions and code which operate on the
data
 Class is a model or pattern from which an
object is created.
 Class is a special module that defines an
object.
◦ The process of creating an object from a class is
called instantiation.
◦ Every object is an instance of a particular class
 There are 3 main characteristics
Encapsulation
•Abstraction via
encapsulation
•Data hiding
Inheritance
•Single
•multiple
Polymorphism
•Operator overloading
•Function overloading
Encapsulation-The concept of sealing data and methods
that operate on the data into an object(a single unit) .
 Abstraction via encapsulation
 data hiding
 Abstraction via encapsulation
 Software object is an abstrat entity in that we view it
from outside. Without concerning oueselves with
detail of how it work on the inside.
 E.g Car and its gear.
 Dividing a program into modules is called
modularity. Not having to know the internal
implementation of a module is called abstraction
 Data hiding
◦ Encapsulation provide the hiding of data
information.
◦ It prevent user from seeing the internal working of
an object.
◦ This is used to protect data, that should not be
manipulated by the user.
◦ Every class can hide some of the part, every
element (field or method) of one class can have one
of the three level of visibility.
◦ They are
 Public
 Private and
 protected
 Public elements are completely visible from
outside the class. They form the interface
with the outside world
 Private elements are visible only to methods
of the class itself.
 Protected elements are something between
public and private.
◦ (act as private elements, but they are completely
visible to inherited child classes)
 Benefits of encapsulation
◦ Improves program reliability
◦ Reduces maintenance
◦ Lends usability
◦ Facilitates information hiding
◦ Improves modularity
◦ Makes coding easier
BASE CLASS
CHILD CLASS
BASE CLASS
CHILD CLASS
 Advantages of using inheritance :
◦ Increased productivity
◦ Reduced maintenance
◦ Standardization
 The major drawback of inheritance is added overhead.
 An user must know changes in the methods of base class before using the
derived classobjects.
 Though the derived class objects may not require all the functionalities of
a base class,the derived class implements all the methods of base class.
This increases the amount ofmemory required for execution of the
program.
 Since common functionalities exist in the base class, there is an execution
overhead forderived class due to the implementation of base class
methods when compared to havingthe functionalities in a single class
itself. In the case of a chain of inheritances, the executionOverhead may
increase further.
 Allows an entity to take a variety of
representations
◦ Operator overloading
 Is the ability to use an operator on different argument
types e.g operator ‘+’ is used to add either integers or
floating point numbers.(for adding two nos and
concatenation of two strings)
 Java does not support user-defined operator
overloading.
 Function overloading
◦ -is the ability to access different implementations
of functions using the same name.
◦ E.g
 printdate(String Str) {……}
 //ans: August 3,2020
 Printdate(int dd,int mm, int yyyy) {…..}
 //ans:3,8,2020
 Two types of function overloading
◦ Early binding
 Allows us to have two functions in the same class that
have the same name with different parameters and
different datatypes passed to it.
 E.g add(int a, int b)
 add(int a, int b, float c)
 Early binding takes place during compile time.
◦ Late binding
 Late binding
◦ Allows us to have functions with same name in base
and derived classes. But the derived class function
will override the base class function.
 Base class functions draw()
 Derived function fill()
 METHOD OVERRIDING
SHAPE
DRAW( )
DRAW( ) DRAW( ) DRAW( )
 In classical procedural (or structural) programming, there are techniques to
write a code that handles some general task
 The most important techniques of that kind are functions (proceduresor sub-
routines). The large program is partitioned into functions that each perform a
specifictask.
 The main program calls these functions, which in turn may call other
functions. The majorconcern of this programming is with respect to the data.
Data are passed around from one non-member function to another and are
available everywhere throughout the large program.
 This allows the user to access the data directly, alter it from several points in
the program and inadvertently introduce mistakes. If one
programmerchanges the representation of the data in the computer's
memory by rearranging fields withina structure (record), other functions in
the program may need to be rewritten and must then beretested to account
for this change. That means the data are not well protected in
procedureoriented programming. Though local variables in a function can be
accessed within the function,they are not useful if they must be accessed by
different functions.
 In contrast, OOP safely encapsulates
collections of functions (called methods)
with the data they manipulate.
 The data can only be manipulated by its
own functions.
 This feature protects the data from rest of
the program.Though the concepts of object
oriented programming are different from
procedural oriented programming,
structured programming constructs are still
used in OOP especially in the codingof
methods.
 Code reusability
 Code modularity
 Easier maintenance
 Design stability
 Improved communication between developers
and users
 Seamless transition from design to
implementation
 Execution overhead-derived classes can be
very complex because of inheritance and
polymorphism
◦ Once a derived class is initiated all the data and
functions from the base classes are carried along
with it.some of these , or even most of it may not
be used
 Abstraction may lead to performance
degradation
 High learning curve
◦ OOP is different from traditional programming.
◦ We must develop strong base classes and
understand the functionality of class libraries
before take advantages from it.
 Difficulty in establishing base classes
◦ Good foundation must be created before derive
other classes.

More Related Content

PPTX
Introduction to java
PPT
Fundamentals of JAVA
PPTX
JAVA LOOP.pptx
ODP
Basic of Java
PPTX
Core java
PDF
Learn Java with Dr. Rifat Shahriyar
PDF
Java Programming Basics
PDF
Introduction to Java Programming Language
Introduction to java
Fundamentals of JAVA
JAVA LOOP.pptx
Basic of Java
Core java
Learn Java with Dr. Rifat Shahriyar
Java Programming Basics
Introduction to Java Programming Language

What's hot (20)

PDF
Genesis and Overview of Java
PDF
Introduction to Java Programming
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
PPT
Java Programming for Designers
PPTX
OOP Introduction with java programming language
PPTX
Presentation on Core java
PPTX
Advance Java Topics (J2EE)
PPTX
Introduction to java
PPTX
Introduction to java
PDF
Methods in Java
PPTX
Java Server Pages(jsp)
PPTX
Introduction to java
PPT
Maven Introduction
PPTX
Methods in java
PDF
Introduction to Java
PPT
Java-java virtual machine
PPTX
Basics of JAVA programming
PPTX
PPTX
Features of java
PPTX
Introduction to JAVA
Genesis and Overview of Java
Introduction to Java Programming
Basic Concepts of OOPs (Object Oriented Programming in Java)
Java Programming for Designers
OOP Introduction with java programming language
Presentation on Core java
Advance Java Topics (J2EE)
Introduction to java
Introduction to java
Methods in Java
Java Server Pages(jsp)
Introduction to java
Maven Introduction
Methods in java
Introduction to Java
Java-java virtual machine
Basics of JAVA programming
Features of java
Introduction to JAVA
Ad

Similar to Introduction to Java -unit-1 (20)

PPTX
Intro to object oriented programming.pptx
PPTX
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
PDF
Oops concepts || Object Oriented Programming Concepts in Java
PDF
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
PPTX
Birasa 1
PPTX
JAVA PROGRAMMING
PPTX
JAVA PROGRAMMINGD
DOCX
Object Oriented Programming All Unit Notes
PPTX
1 intro
PPTX
Chapter1 introduction
PPTX
IET307 OOP - object oriented programming concepts.pptx
PPT
Share Unit 1- Basic concept of object-oriented-programming.ppt
PPT
Unit 1- Basic concept of object-oriented-programming.ppt
PPTX
POP vs OOP Introduction
PPTX
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
PPTX
OOPS in Java
PDF
OOP concepts with respected with Python
PPTX
OOPs Java Module 1.pptx marketing trends social media company profilesmarketi...
PPTX
Presentation c
PDF
object oriented programming concepts and explanation
Intro to object oriented programming.pptx
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
Oops concepts || Object Oriented Programming Concepts in Java
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
Birasa 1
JAVA PROGRAMMING
JAVA PROGRAMMINGD
Object Oriented Programming All Unit Notes
1 intro
Chapter1 introduction
IET307 OOP - object oriented programming concepts.pptx
Share Unit 1- Basic concept of object-oriented-programming.ppt
Unit 1- Basic concept of object-oriented-programming.ppt
POP vs OOP Introduction
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
OOPS in Java
OOP concepts with respected with Python
OOPs Java Module 1.pptx marketing trends social media company profilesmarketi...
Presentation c
object oriented programming concepts and explanation
Ad

More from RubaNagarajan (19)

PPTX
Computer graphics-CRT.pptx
PPTX
Matrix representation- CG.pptx
PPTX
Personality development.pptx
PPTX
TRANSFORMATION-CG.pptx
PPTX
dda algorithm-cg.pptx
PPTX
line attributes.pptx
PPT
Java files and io streams
PPTX
Java -Exception handlingunit-iv
PPTX
Java Programming
PPTX
Features of java unit 1
PPTX
Constructors in C++
PPTX
Risks in cc
PPTX
Dreamweaver
PPT
Working principles of internet
PPT
Coreldraw
PPT
C programming
PPT
OPERATING SYSTEM
PDF
Virtualization in cloud computing
PDF
Cloud computing technology
Computer graphics-CRT.pptx
Matrix representation- CG.pptx
Personality development.pptx
TRANSFORMATION-CG.pptx
dda algorithm-cg.pptx
line attributes.pptx
Java files and io streams
Java -Exception handlingunit-iv
Java Programming
Features of java unit 1
Constructors in C++
Risks in cc
Dreamweaver
Working principles of internet
Coreldraw
C programming
OPERATING SYSTEM
Virtualization in cloud computing
Cloud computing technology

Recently uploaded (20)

PDF
faiz-khans about Radiotherapy Physics-02.pdf
PPT
hemostasis and its significance, physiology
PPTX
Thinking Routines and Learning Engagements.pptx
PDF
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
PDF
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
PPTX
Integrated Management of Neonatal and Childhood Illnesses (IMNCI) – Unit IV |...
PDF
Hospital Case Study .architecture design
PDF
Physical education and sports and CWSN notes
PDF
Lecture on Viruses: Structure, Classification, Replication, Effects on Cells,...
PPTX
Theoretical for class.pptxgshdhddhdhdhgd
PDF
Diabetes Mellitus , types , clinical picture, investigation and managment
PDF
Farming Based Livelihood Systems English Notes
PDF
Nurlina - Urban Planner Portfolio (english ver)
PDF
anganwadi services for the b.sc nursing and GNM
PDF
Everyday Spelling and Grammar by Kathi Wyldeck
PPTX
Why I Am A Baptist, History of the Baptist, The Baptist Distinctives, 1st Bap...
PDF
FYJC - Chemistry textbook - standard 11.
DOCX
EDUCATIONAL ASSESSMENT ASSIGNMENT SEMESTER MAY 2025.docx
PPTX
IT infrastructure and emerging technologies
PDF
0520_Scheme_of_Work_(for_examination_from_2021).pdf
faiz-khans about Radiotherapy Physics-02.pdf
hemostasis and its significance, physiology
Thinking Routines and Learning Engagements.pptx
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
fundamentals-of-heat-and-mass-transfer-6th-edition_incropera.pdf
Integrated Management of Neonatal and Childhood Illnesses (IMNCI) – Unit IV |...
Hospital Case Study .architecture design
Physical education and sports and CWSN notes
Lecture on Viruses: Structure, Classification, Replication, Effects on Cells,...
Theoretical for class.pptxgshdhddhdhdhgd
Diabetes Mellitus , types , clinical picture, investigation and managment
Farming Based Livelihood Systems English Notes
Nurlina - Urban Planner Portfolio (english ver)
anganwadi services for the b.sc nursing and GNM
Everyday Spelling and Grammar by Kathi Wyldeck
Why I Am A Baptist, History of the Baptist, The Baptist Distinctives, 1st Bap...
FYJC - Chemistry textbook - standard 11.
EDUCATIONAL ASSESSMENT ASSIGNMENT SEMESTER MAY 2025.docx
IT infrastructure and emerging technologies
0520_Scheme_of_Work_(for_examination_from_2021).pdf

Introduction to Java -unit-1

  • 1. BY N.RUBA ASST.PROF/DEPT. OF CA, BON SECOURS COLLEGE FOR WOMEN, THANJAVUR.
  • 2.  JAVA - A general purpose, high- level, object-oriented, cross- platform programming language developed by James Gosling at Sun Microsystems in 1995.  In structured programming, a complex program is broken into sets of smaller, understandable tasks; but it is very hard to maintain.
  • 3.  Introduction to oop ◦ A procedure is defined as a collection of instruction executed in sequential order.  Oops concept was introduced by Xerox Corporation in early 1970s.  The first object oriented language was Smalltalk.  Oops languages: C++,Java and Eiffel.
  • 4.  Objects and Classes are building blocks of OOP.  Object is a Programming entity in OOP. ◦ It has data components representing the present state of the object as well as functions also called methods.  Object contains ◦ Attributes- data associated with the object ◦ Methods-functions and code which operate on the data
  • 5.  Class is a model or pattern from which an object is created.  Class is a special module that defines an object. ◦ The process of creating an object from a class is called instantiation. ◦ Every object is an instance of a particular class
  • 6.  There are 3 main characteristics Encapsulation •Abstraction via encapsulation •Data hiding Inheritance •Single •multiple Polymorphism •Operator overloading •Function overloading
  • 7. Encapsulation-The concept of sealing data and methods that operate on the data into an object(a single unit) .  Abstraction via encapsulation  data hiding  Abstraction via encapsulation  Software object is an abstrat entity in that we view it from outside. Without concerning oueselves with detail of how it work on the inside.  E.g Car and its gear.  Dividing a program into modules is called modularity. Not having to know the internal implementation of a module is called abstraction
  • 8.  Data hiding ◦ Encapsulation provide the hiding of data information. ◦ It prevent user from seeing the internal working of an object. ◦ This is used to protect data, that should not be manipulated by the user. ◦ Every class can hide some of the part, every element (field or method) of one class can have one of the three level of visibility. ◦ They are  Public  Private and  protected
  • 9.  Public elements are completely visible from outside the class. They form the interface with the outside world  Private elements are visible only to methods of the class itself.  Protected elements are something between public and private. ◦ (act as private elements, but they are completely visible to inherited child classes)
  • 10.  Benefits of encapsulation ◦ Improves program reliability ◦ Reduces maintenance ◦ Lends usability ◦ Facilitates information hiding ◦ Improves modularity ◦ Makes coding easier
  • 11. BASE CLASS CHILD CLASS BASE CLASS CHILD CLASS
  • 12.  Advantages of using inheritance : ◦ Increased productivity ◦ Reduced maintenance ◦ Standardization  The major drawback of inheritance is added overhead.  An user must know changes in the methods of base class before using the derived classobjects.  Though the derived class objects may not require all the functionalities of a base class,the derived class implements all the methods of base class. This increases the amount ofmemory required for execution of the program.  Since common functionalities exist in the base class, there is an execution overhead forderived class due to the implementation of base class methods when compared to havingthe functionalities in a single class itself. In the case of a chain of inheritances, the executionOverhead may increase further.
  • 13.  Allows an entity to take a variety of representations ◦ Operator overloading  Is the ability to use an operator on different argument types e.g operator ‘+’ is used to add either integers or floating point numbers.(for adding two nos and concatenation of two strings)  Java does not support user-defined operator overloading.
  • 14.  Function overloading ◦ -is the ability to access different implementations of functions using the same name. ◦ E.g  printdate(String Str) {……}  //ans: August 3,2020  Printdate(int dd,int mm, int yyyy) {…..}  //ans:3,8,2020
  • 15.  Two types of function overloading ◦ Early binding  Allows us to have two functions in the same class that have the same name with different parameters and different datatypes passed to it.  E.g add(int a, int b)  add(int a, int b, float c)  Early binding takes place during compile time. ◦ Late binding
  • 16.  Late binding ◦ Allows us to have functions with same name in base and derived classes. But the derived class function will override the base class function.  Base class functions draw()  Derived function fill()
  • 17.  METHOD OVERRIDING SHAPE DRAW( ) DRAW( ) DRAW( ) DRAW( )
  • 18.  In classical procedural (or structural) programming, there are techniques to write a code that handles some general task  The most important techniques of that kind are functions (proceduresor sub- routines). The large program is partitioned into functions that each perform a specifictask.  The main program calls these functions, which in turn may call other functions. The majorconcern of this programming is with respect to the data. Data are passed around from one non-member function to another and are available everywhere throughout the large program.  This allows the user to access the data directly, alter it from several points in the program and inadvertently introduce mistakes. If one programmerchanges the representation of the data in the computer's memory by rearranging fields withina structure (record), other functions in the program may need to be rewritten and must then beretested to account for this change. That means the data are not well protected in procedureoriented programming. Though local variables in a function can be accessed within the function,they are not useful if they must be accessed by different functions.
  • 19.  In contrast, OOP safely encapsulates collections of functions (called methods) with the data they manipulate.  The data can only be manipulated by its own functions.  This feature protects the data from rest of the program.Though the concepts of object oriented programming are different from procedural oriented programming, structured programming constructs are still used in OOP especially in the codingof methods.
  • 20.  Code reusability  Code modularity  Easier maintenance  Design stability  Improved communication between developers and users  Seamless transition from design to implementation
  • 21.  Execution overhead-derived classes can be very complex because of inheritance and polymorphism ◦ Once a derived class is initiated all the data and functions from the base classes are carried along with it.some of these , or even most of it may not be used  Abstraction may lead to performance degradation
  • 22.  High learning curve ◦ OOP is different from traditional programming. ◦ We must develop strong base classes and understand the functionality of class libraries before take advantages from it.  Difficulty in establishing base classes ◦ Good foundation must be created before derive other classes.