Beruflich Dokumente
Kultur Dokumente
3/5/2018 3
CONCEPTS OF OOPS
• Objects
• Classes
• Encapsulation
• Data Abstraction
• Inheritance
• Polymorphism
3/5/2018 4
Objects
Object=Data+Method
3/5/2018 5
Classes
A class describes a group of objects with
similar attributes, operations and
relationship to other objects
3/5/2018 6
Encapsulation
Encapsulation is the mechanism that binds
together code and the data it manipulates ,
and keeps both safe from outside
interference and misuse.
3/5/2018 7
Data Abstraction
• The act of representing essential features
without including the background details
or explanations.
• Classes use the concept of abstraction and
defined as a list of attributes, and
functions to operate these attributes.
• It’s also known as Abstract DataTypes(ADT)
8
Inheritance
Inheritance is the process by which objects of one
class acquires the properties of objects of another class.
Mammal Reptile
Dog
Cat
9
Polymorphism
Polymorphism is a feature that allows one
interface to be used for a general class of actions
or
“one interface, multiple methods”
Shape
Draw ()
• Code sharing
• Rapid prototyping
• Information hiding
11
Need For Java
14
Features of Java
• Java is simple
• Java is object-oriented
• Java is distributed
• Java is interpreted and High Performance
• Java is robust
• Java is secure
• Java is architecture-neutral
• Java is portable
• Java’s performance
• Java is multithreaded
• Java is dynamic
15
Sun describes it as
"A simple, object-oriented,
distributed, interpreted, robust,
secure, architecture neutral,
portable, high-performance,
multi-threaded and dynamic
language."
16
Simple
• Java was designed to be easy for the professional
programmer to learn and use effectively
Programmer
Notepad,
emacs,vi
Java is architecture-Neutral
26
The byte code. The Java runtime system does not compile
your source code directly into machine language, an
inflexible and nonportable representation of your program.
Instead, Java programs are translated into machine-
independent byte code. The byte code is easily interpreted
and therefore can be executed on any platform having a
Java runtime system. (The latest versions of the Netscape
Navigator browser, for example, can run applets on
virtually any platform).
27
Robust
Java is robust language .It provides many safeguards to ensure reliable code. It
has strict compile time and runtime checking for data types.
It has several features designed to avoid crashes during program execution,
including:
• No pointer arithmetic
• Garbage collection--no bad addresses
• It incorporates the concept of exception handling which captures errors and
eliminate the risk of crashing the system
• No jumping to bad method addresses
• Interfaces and exceptions
The single biggest difference between Java and C/C++ is that Java has
“a inner safe pointer-model”, therefore it eliminates the possibility of
overwriting memory and corrupting data, so programmers feel very safe in
coding.
28
Security
The Java language is secure it is very difficult to write incorrect code or viruses
that can corrupt/steal your data, or harm hardware such as hard disks.Java system
not only verify all memory access but also ensure that no viruses are
communicated with an applet.
29
Distributed
• Java is designed for the distributed environment of the internet,
because it handles TCP/IP protocols.
• It has the ability share both data and programs.
• Java applications can open and access remote objects on internet
as easily as they can do in a local system.
C++
C Java
JAVA and C
Java is lot like C but difference is java is object oriented language