KEMBAR78
object oriented programming concept in java.pptx
PRESENTED BY:
FARHANA THASNIM.M
HAJIRA BEE.A
MUhsINA PARVEEN .N.A
AQMAL BEGUM.S
OBJECTIVES:
 BASIC OF PROGRAMMING LANGUAGE.
 WHAT IS OOPS?
 JAVA OVERVIEW(HISTORY,FEATURES).
 OOPS CONCEPT IN JAVA.
 JAVA COMPARE WITH C++.
 EXAMPLE PROGRAMS OF JAVA AND C++.
WHAT IS OBJECT ORIENTED PROGRAMMING?
Object oriented
programming is a computer
programming model that organize
software design around data, or
object ,rather then functions and
logic . An object can be defined
as a data field that has unique
attributes and behavior.
PROGRAMMING LANGUAGE:
It is a formal computer language which is
designed to communicate
instruction or commands or orders
to a machine , particularly a
computer programming
languages can be used to create
programs to control behaviour of
the machine.
What is java?
Java is an object-oriented,
cross-platform programming
language introduced
in 1995 by Sun
Microsystems .
Today , Java helps run
many applications ,
including Sport ,
Social Media ,
Audio , Video , etc,…
JAVA FEATURES:
Object oriented Programming (oop)
is a computer programming model
that organizes software Design
around data , or objects , rather than
functions and logic. An Object can
be defined as a data field that has
unique attributes and behaviour.
What is OOP(Object Oriented Programming)?
CLASS :
A class is a group of
objects that share common
properties and behaviour .
You can also think of a
class as a blueprint from
which you can create
an individual object.
keyword : class
Example of class:
Class Bicycle
{
Private int gear=5;
Public void braking()
{
System.out.println(“Working of braking:”);
}
}
REAL TIME EXAMPLE:
object:
In the java programming language ,
an object is an instance of
a java class ,meaning it’s a
copy of a specific class .
Java objects have three
primary characteristics:
identity , state and behavior.
EXAMPLE OF OBJECT:
Create an object called "myObj" and print the value of
x:
public class Main
{
int x = 5;
public static void main(String[] args)
{
Main myObj = new Main();
System.out.println(myObj.x);
}
}
Inheritance:
The process of obtaining the
data members four methods
from one class to another
class is known as
inheritance .
It’s one of the fundamental
features of oops .
Real time example in inheritance:
Example of inheritance:
Class Employee
{
Float salary=40000;
}
Class programmer extends Employee
{
int bonus= 10000;
Public static void main(String [] args)
{
Programmer P =new programmer();
System.out.println(“programmer salary is :”+p.salary);
System.out.println(”Bonus of programmer is :”+p.bonus);
}
}
Abstraction means hiding
Lower-level
details and Exposing
only those essential
And relevant details
to the users .
Abstraction:
Example of Abstract class that has an abstract method
abstract class Bike
{
abstract void run();
}
class Honda4 extends Bike
{
void run(){System.out.println("running safely");}
public static void main(String args[])
{
Bike obj = new Honda4();
obj.run();
}
}
ENCAPSULATION:
Encapsulation is a process of
wrapping data and method in a single
unit is called encapsulation .
In oops , data and methods operating
on that data are combined together to
form a single unit , which is referred
to as a class .
It is the mechanism that binds
together code and the data it
manipulates and keeps both safes
form outside interface and misuse .
in real time example:
Example of Encapsulation in Java:
package com.javatpoint;
class student
{
public static void main(String[] args)
{
Student s=new Student();
s.setName("vijay");
System.out.println(s.getName());
}
}
Polymorphism:
 The process of representing one form in
multiple form is known as polymorphism
.
 It is allows us to perform a single
action in different way.
 It is allows you to define one interface
and have multiple implementation.
 Polymorphism means many form .
Example of Java Runtime Polymorphism:
class Bike
{
void run(){System.out.println("running");
}
}
class Splendor extends Bike
{
void run(){System.out.println("running safely with 60km");
}
public static void main(String []args)
{
Bike b = new Splendor();
b.run();
}
}
S.NO PARAMETERS JAVA C++
1. Portability It can run on any OS
hence it is portable.
C++ is platform
dependent hence it is not
portable.
2. compilation Java is both compiled
and interpreted language.
C++ is a compiled
language.
3. Memory Management is
System Controlled.
Memory Management in
C++ is Manual.
4. Virtual Keyword It doesn’t have a Virtual
Keyword.
It has Virtual keywords.
5. Multiple Inheritance It supports only single
inheritance. Multiple
inheritances are achieved
partially using interfaces.
It supports both single
and multiple Inheritance.
6. Overloading It supports only method
overloading and doesn’t
allow operator
It supports both method
and operator
overloading.
Memory
Management
7. Pointers It has limited support for
pointers.
It strongly supports
pointers.
8. Libraries Libraries have a wide range
of classes for various high-
level services.
C++ libraries have
comparatively low-level
functionalities.
9. Documentation
Comment
It supports documentation
comments (e.g., /**.. */) for
source code.
It doesn’t support
documentation comments
for source code.
10.
Thread
Support
Java provides built-in support
for multithreading.
C++ doesn’t have built-in
support for threads,
depends on third-party
threading libraries.
11.
Type
Java is only an object-
oriented programming
language.
C++ is both a procedural
and an object-oriented
programming language.
12. Input-Output
mechanism
Java uses the (System
class): System.in for input
C++ uses cin for input
and cout for an output
APPLICATIONS OF JAVA PROGRAMMING LANGUAGE:
 Desktop GUI Applications development.
 Android and Mobile application development.
 Application of java are in embedded
technologies lie SIM cards , disk players , TV ,
etc,..
 Java EE(Enterprise Edition) provides an API and
runtime environment for running large enterprise
software.
 Network Applications and Web services like
Internet connection , Web App Development.
SYNTAX OF JAVA :
import java.io.*;
class GFG
{
public static void main (String[] args)
{
System.out.println("GFG!");
}
}
EXAMPLE OF JAVA PROGRAM:
Import java.io.*;
Class person
{
String name;
int age;
Person (int age, string name)
{
this.name = name;
this.age=age;
}
}
Class Employee extends person
{
int emp _ id;
int emp _ salary;
Employee( int id, String name, int age , int salary)
{
Super(age , name);
emp_id=id;
emp_salary=salary;
}
System.out.println(“Employee ID:”+emp_id);
System.out.println(“Employee name:”+name);
System.out.println(“Employee age:”+age);
System.out.println(“Employee salary:”+emp_salary);
}
}
Public class main
{
Public static void main(string[]args)
{
Employee emp=new
Employee(101,”SAMANTHA”,20,60000);
emp.printEmployeeDetails();
}
}
OUTPUT:

object oriented programming concept in java.pptx

  • 2.
    PRESENTED BY: FARHANA THASNIM.M HAJIRABEE.A MUhsINA PARVEEN .N.A AQMAL BEGUM.S
  • 4.
    OBJECTIVES:  BASIC OFPROGRAMMING LANGUAGE.  WHAT IS OOPS?  JAVA OVERVIEW(HISTORY,FEATURES).  OOPS CONCEPT IN JAVA.  JAVA COMPARE WITH C++.  EXAMPLE PROGRAMS OF JAVA AND C++.
  • 5.
    WHAT IS OBJECTORIENTED PROGRAMMING? Object oriented programming is a computer programming model that organize software design around data, or object ,rather then functions and logic . An object can be defined as a data field that has unique attributes and behavior.
  • 7.
    PROGRAMMING LANGUAGE: It isa formal computer language which is designed to communicate instruction or commands or orders to a machine , particularly a computer programming languages can be used to create programs to control behaviour of the machine.
  • 10.
    What is java? Javais an object-oriented, cross-platform programming language introduced in 1995 by Sun Microsystems . Today , Java helps run many applications , including Sport , Social Media , Audio , Video , etc,…
  • 12.
  • 13.
    Object oriented Programming(oop) is a computer programming model that organizes software Design around data , or objects , rather than functions and logic. An Object can be defined as a data field that has unique attributes and behaviour. What is OOP(Object Oriented Programming)?
  • 17.
    CLASS : A classis a group of objects that share common properties and behaviour . You can also think of a class as a blueprint from which you can create an individual object. keyword : class
  • 18.
    Example of class: ClassBicycle { Private int gear=5; Public void braking() { System.out.println(“Working of braking:”); } }
  • 19.
  • 21.
    object: In the javaprogramming language , an object is an instance of a java class ,meaning it’s a copy of a specific class . Java objects have three primary characteristics: identity , state and behavior.
  • 22.
    EXAMPLE OF OBJECT: Createan object called "myObj" and print the value of x: public class Main { int x = 5; public static void main(String[] args) { Main myObj = new Main(); System.out.println(myObj.x); } }
  • 25.
    Inheritance: The process ofobtaining the data members four methods from one class to another class is known as inheritance . It’s one of the fundamental features of oops .
  • 26.
    Real time examplein inheritance:
  • 27.
    Example of inheritance: ClassEmployee { Float salary=40000; } Class programmer extends Employee { int bonus= 10000; Public static void main(String [] args) { Programmer P =new programmer(); System.out.println(“programmer salary is :”+p.salary); System.out.println(”Bonus of programmer is :”+p.bonus); } }
  • 29.
    Abstraction means hiding Lower-level detailsand Exposing only those essential And relevant details to the users . Abstraction:
  • 31.
    Example of Abstractclass that has an abstract method abstract class Bike { abstract void run(); } class Honda4 extends Bike { void run(){System.out.println("running safely");} public static void main(String args[]) { Bike obj = new Honda4(); obj.run(); } }
  • 33.
    ENCAPSULATION: Encapsulation is aprocess of wrapping data and method in a single unit is called encapsulation . In oops , data and methods operating on that data are combined together to form a single unit , which is referred to as a class . It is the mechanism that binds together code and the data it manipulates and keeps both safes form outside interface and misuse .
  • 34.
    in real timeexample:
  • 35.
    Example of Encapsulationin Java: package com.javatpoint; class student { public static void main(String[] args) { Student s=new Student(); s.setName("vijay"); System.out.println(s.getName()); } }
  • 37.
    Polymorphism:  The processof representing one form in multiple form is known as polymorphism .  It is allows us to perform a single action in different way.  It is allows you to define one interface and have multiple implementation.  Polymorphism means many form .
  • 39.
    Example of JavaRuntime Polymorphism: class Bike { void run(){System.out.println("running"); } } class Splendor extends Bike { void run(){System.out.println("running safely with 60km"); } public static void main(String []args) { Bike b = new Splendor(); b.run(); } }
  • 41.
    S.NO PARAMETERS JAVAC++ 1. Portability It can run on any OS hence it is portable. C++ is platform dependent hence it is not portable. 2. compilation Java is both compiled and interpreted language. C++ is a compiled language. 3. Memory Management is System Controlled. Memory Management in C++ is Manual. 4. Virtual Keyword It doesn’t have a Virtual Keyword. It has Virtual keywords. 5. Multiple Inheritance It supports only single inheritance. Multiple inheritances are achieved partially using interfaces. It supports both single and multiple Inheritance. 6. Overloading It supports only method overloading and doesn’t allow operator It supports both method and operator overloading. Memory Management
  • 42.
    7. Pointers Ithas limited support for pointers. It strongly supports pointers. 8. Libraries Libraries have a wide range of classes for various high- level services. C++ libraries have comparatively low-level functionalities. 9. Documentation Comment It supports documentation comments (e.g., /**.. */) for source code. It doesn’t support documentation comments for source code. 10. Thread Support Java provides built-in support for multithreading. C++ doesn’t have built-in support for threads, depends on third-party threading libraries. 11. Type Java is only an object- oriented programming language. C++ is both a procedural and an object-oriented programming language. 12. Input-Output mechanism Java uses the (System class): System.in for input C++ uses cin for input and cout for an output
  • 43.
    APPLICATIONS OF JAVAPROGRAMMING LANGUAGE:  Desktop GUI Applications development.  Android and Mobile application development.  Application of java are in embedded technologies lie SIM cards , disk players , TV , etc,..  Java EE(Enterprise Edition) provides an API and runtime environment for running large enterprise software.  Network Applications and Web services like Internet connection , Web App Development.
  • 45.
    SYNTAX OF JAVA: import java.io.*; class GFG { public static void main (String[] args) { System.out.println("GFG!"); } }
  • 47.
    EXAMPLE OF JAVAPROGRAM: Import java.io.*; Class person { String name; int age; Person (int age, string name) { this.name = name; this.age=age; } } Class Employee extends person {
  • 48.
    int emp _id; int emp _ salary; Employee( int id, String name, int age , int salary) { Super(age , name); emp_id=id; emp_salary=salary; } System.out.println(“Employee ID:”+emp_id); System.out.println(“Employee name:”+name); System.out.println(“Employee age:”+age); System.out.println(“Employee salary:”+emp_salary); } } Public class main { Public static void main(string[]args)
  • 49.