java oops - key components

22
Java OOPS – Key Components By Apex TG India Pvt Ltd http://www.apextgi.in

Upload: apex-tgi

Post on 10-Nov-2015

14 views

Category:

Documents


0 download

DESCRIPTION

Abstraction is the force that hide private implementation details behind public interfaces. Or You can say that showing only relevant information is known as Abstraction.

TRANSCRIPT

  • Java OOPS Key Components

    ByApex TG India Pvt Ltdhttp://www.apextgi.in

  • There are four tools that make Java as Java

    JVM (Java Virtual Machine) JRE (Java Runtime Environment) Garbage Collection JVM tools interface

  • JVM is an imaginary machine which works like an emulator at the runtime. All the JVM code stores in .class file which is generated after compilation. The codes inside .class file is known as Bytecodes and these Bytecodes is the language of JVM

    a.java compiler a.class

    Windows

    UNIX/LINUX

    Mac

    JVM

  • JRE Contains:

    Class Loader Bytecodes Verifier Interpreter/JIT Compiler Runtime Hardware

  • a.java

    a.class

    compiler

    Load from Hard disk,

    network module

    Class loader

    Bytecodes verifier

    Hardware

    Interpreter

    Runtime

  • In c, C++ we were responsible for the de-allocation of memory. This was a difficult exercise at times , because we do not always know in advance when memory should be released.

    The Java Programming language removes your from the responsibility of de-allocating memory. It provide a system level thread that tracks each memory allocation.

    Advantage: Save data from Memory Leaks

  • public class HelloWorld{

    private String message=Welcome in Java Programming;public String sayHello(){

    System.out.println(message);return message;

    }public static void main(String[] args){

    HelloWorld hello=new HelloWorld();hello.sayHello();

    }}

    Output:Welcome in Java Programming

  • Object Classes Inheritance Abstraction Encapsulation Polymorphism

  • Object is a real world entity which has its own state and behavior.

    Example: Dogs have state (name, color, breed, hungry) and behavior (barking, fetching, wagging tail)

    Bicycles also have state (current gear, current pedal cadence, current speed) and behavior (changing gear, changing pedal cadence, applying brakes).

  • What Is a Class?

    A class is the blueprint from which individual objects are created. In the real world, you'll often find many individual objects all of the same kind. Each bicycle was built from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles.

  • What Is Inheritance?

    Passing the basic property of a parent class into its child class is known as Inheritance.

    Example:

    Mountain bikes, road bikes, and tandem bikes, for example, all share the characteristics of bicycles (current speed, current pedal cadence, current gear).

  • What Is Abstraction?

    Abstraction is the force that hide private implementation details behind public interfaces. Or You can say that showing only relevant information is known as Abstraction.

    Example:

    Withdrawing money from ATM machine is a good example of abstraction.

  • What Is Encapsulation?

    Hiding the complexity or wrapping of data into a single capsule or module is known as Encapsulation.

    To achieve encapsulation in your Java program you should declare all the instance variable as private, and the method that use these variable as public

  • What Is Polymorphism?

  • What Is a Package?

    A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer.

  • In Java Programming ,an identifier is a name of a variable , a class, or a method.

    Identifier starts with a letter, underscore, or dollar sign($), subsequent character can be digits

    Followings are valid identifier: Identifier userName User_name _sys_var1 $change

  • * not used

    ** added in 1.2

    *** added in 1.4

    **** added in 5.0

  • There are eight primitive types in Java Programming

  • Operators are special symbols that perform specific operations on one, two, or three operands, and then return a result. There are:

    Arithmetic Operators Unary Operators Assignment Operator Bitwise and Bit shift Operator Relational and Conditional operator

  • PowerPoint PresentationSlide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22