KEMBAR78
Basic of Java | ODP
Presentation By:-
Ajeet Kumar Verma
B.C.A 3rd
yr
PROGRAMMING IN JAVA
Introduction to JAVA
Topic:-Genesis and overview of
Java
Contents
• What is JAVA?
● • What is OOPs?
● • Why Java?
● Characteristics of JAVA
● Overview of Java.
● The difference between Java and C++?
● A Simple JAVA Program
What is JAVA?
● Developed by Sun Microsystems (James Gosling)
● A general-purpose Object-Oriented language
● Based on C/C++
● Designed for easy Web/Internet applications
● Widespread acceptance
What is Object Oriented
Programming?
● Object-oriented programming is a method of
implementation in which programs are organized as
cooperative collections of objects, each of which
represents an instance of some class, and whose
classes are all members of one or more hierarchy of
classes united via inheritance relationships.
Principles of OOP
● All object-oriented programming languages provide
mechanisms that help you implement the
objectoriented model.
• They are:--
● Encapsulation
● Inheritance
● Polymorphism
Data Encapsulation
● Encapsulation is the mechanism that binds together
code and the data it manipulates, and keeps both safe
from outside interference and misuse.
● Example:-
class Account {
int x=10;
float withdraw();
void deposit(float amount);
float balance;
}
Advantages of Encapsulation
● Protection
● Consistency
● Allows change
Inheritance
● Inheritance is the process by which one object acquires the
properties of another object.
● A class that is derived from another class is called a subclass
(also a derived class, extended class, or child class).
● The class from which the subclass is derived is called a super
class (also a base class or a parent class).
● A class which is a subtype of a more general class is said to
be inherited from it.
Inheritance cont’d
● The sub-class inherits the base class’ data members
and member functions.
● A sub-class has all data members of its base-class
plus its own.
● A sub-class has all member functions of its base
class (with changes) plus its own.
Polymorphism
● Polymorphism refers to a programming language's ability to process
objects differently depending on their data type or class.
● Generally, the ability to appear in many forms.
● More specifically, it is the ability to redefine methods for derived
classes.
● For example, given a base class shape, polymorphism enables the
programmer to define different area methods for any number of derived
classes, such as circles, rectangles and triangles. No matter what shape
an object is, applying the area method to it will return the correct results.
Why Java?
● Java is the Internet programming language.
● Java enables users to develop and deploy
applications on the Internet for servers, desktop
computers, and small hand-held devices.
Characteristics of Java
● Java Is Simple
● Java Is Object-Oriented
● Java Is Distributed
● Java Is Interpreted
● Java Is Robust
● Java Is Secure
● Java Is Architecture-Neutral
● Java Is Portable
● Java's Performance
● Java Is Multithreaded
● Java Is Dynamic
JDK Versions
● JDK 1.02 (1995) … 250 classes
● JDK 1.1 (1996) … 500 classes
● JDK 1.2 (1998) … 2300 classes
● JDK 1.3 (2000) … 2300 classes
● JDK 1.4 (2002) … 2300 classes
● JDK 1.5 (2004) … 3500 classes
● JDK 1.6 (2006) … 3500 classes
● JDK 1.7 (2011) … 3500 classes
A Simple Java Program
● //This program prints Welcome to Java!
public class Welcome
{
public static void main(String[] args)
{
System.out.println("Welcome to Java!");
{
{

Basic of Java

  • 1.
  • 2.
    PROGRAMMING IN JAVA Introductionto JAVA Topic:-Genesis and overview of Java
  • 3.
    Contents • What isJAVA? ● • What is OOPs? ● • Why Java? ● Characteristics of JAVA ● Overview of Java. ● The difference between Java and C++? ● A Simple JAVA Program
  • 4.
    What is JAVA? ●Developed by Sun Microsystems (James Gosling) ● A general-purpose Object-Oriented language ● Based on C/C++ ● Designed for easy Web/Internet applications ● Widespread acceptance
  • 5.
    What is ObjectOriented Programming? ● Object-oriented programming is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of one or more hierarchy of classes united via inheritance relationships.
  • 6.
    Principles of OOP ●All object-oriented programming languages provide mechanisms that help you implement the objectoriented model. • They are:-- ● Encapsulation ● Inheritance ● Polymorphism
  • 7.
    Data Encapsulation ● Encapsulationis the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. ● Example:- class Account { int x=10; float withdraw(); void deposit(float amount); float balance; }
  • 8.
    Advantages of Encapsulation ●Protection ● Consistency ● Allows change
  • 9.
    Inheritance ● Inheritance isthe process by which one object acquires the properties of another object. ● A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). ● The class from which the subclass is derived is called a super class (also a base class or a parent class). ● A class which is a subtype of a more general class is said to be inherited from it.
  • 10.
    Inheritance cont’d ● Thesub-class inherits the base class’ data members and member functions. ● A sub-class has all data members of its base-class plus its own. ● A sub-class has all member functions of its base class (with changes) plus its own.
  • 11.
    Polymorphism ● Polymorphism refersto a programming language's ability to process objects differently depending on their data type or class. ● Generally, the ability to appear in many forms. ● More specifically, it is the ability to redefine methods for derived classes. ● For example, given a base class shape, polymorphism enables the programmer to define different area methods for any number of derived classes, such as circles, rectangles and triangles. No matter what shape an object is, applying the area method to it will return the correct results.
  • 12.
    Why Java? ● Javais the Internet programming language. ● Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices.
  • 13.
    Characteristics of Java ●Java Is Simple ● Java Is Object-Oriented ● Java Is Distributed ● Java Is Interpreted ● Java Is Robust ● Java Is Secure ● Java Is Architecture-Neutral ● Java Is Portable ● Java's Performance ● Java Is Multithreaded ● Java Is Dynamic
  • 14.
    JDK Versions ● JDK1.02 (1995) … 250 classes ● JDK 1.1 (1996) … 500 classes ● JDK 1.2 (1998) … 2300 classes ● JDK 1.3 (2000) … 2300 classes ● JDK 1.4 (2002) … 2300 classes ● JDK 1.5 (2004) … 3500 classes ● JDK 1.6 (2006) … 3500 classes ● JDK 1.7 (2011) … 3500 classes
  • 15.
    A Simple JavaProgram ● //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { System.out.println("Welcome to Java!"); { {