1.- about the java technology.pptx

Upload: ferdinand-lawlliet-cadd-mood

Post on 03-Jun-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 1.- About the Java Technology.pptx

    1/25

    About the Java Technology

    Copyright 1995, 2011 Oracle and/or its affiliates. All rights reserved.

    Adriana Rojas Molina

    Agosto- Diciembre 2014

  • 8/11/2019 1.- About the Java Technology.pptx

    2/25

    Java Technology

    Java technology is :

    A Programming language

    A platform

    The Java programming language:

    High-level language characterized by the following

    buzzwords

    Simple Architecture

    neutral

    Object oriented Portable Dynamic

    Distributed High

    performance

    Multithreaded Robust Secure

  • 8/11/2019 1.- About the Java Technology.pptx

    3/25

    Simple, Objected Oriented

    Simple: Fundamental concepts are grasped

    quickly

    Without extensive programmer training

    Objected Oriented: Object technology had

    been in the world since thirty years ago

  • 8/11/2019 1.- About the Java Technology.pptx

    4/25

  • 8/11/2019 1.- About the Java Technology.pptx

    5/25

    Architecture Neutral, Portable

    Architecture Neutral: Java technology is

    designed to support applications that will be

    deployed into heterogeneous network

    environments

    Portable: Your programs are the same on

    every platform (there are no data type

    incompatibilities across hardware and

    software)

  • 8/11/2019 1.- About the Java Technology.pptx

    6/25

    High performance

    The java platform achieves superior

    performance by adopting a scheme by with

    the interpreter can run at full speed without

    needing to check the run-time enviroment.

  • 8/11/2019 1.- About the Java Technology.pptx

    7/25

    Threaded, Dynamic

    A user working with HotJava Browser can run

    several animations concurrently while

    downloading an image an scrolling the page.

    Multithreading capability means to build

    applications with many concurrent threads of

    activity

    The language and rutime system are dynamic

    in their linking stages.

  • 8/11/2019 1.- About the Java Technology.pptx

    8/25

    Being familiar with the java technology

    (1/2)

    Al source code is first written in plain text files ending with

    the .java extension.

    .java files are then compiled into .class files by the javac

    compiler. A .class file does not contain code that is native to

    your processor, it instead contains bytecodesthe machine

    language of the Java Virtual Machine). The java laucher tool

    then runs your application with an instance of the JVM

  • 8/11/2019 1.- About the Java Technology.pptx

    9/25

    Java VM is available on many

    different operating systems so

    the same .class files are capable

    of running on Windows, Solaris,

    Linux, Mac OS.

    Some virtual machines (Java

    HotSpot virtual machine),

    perform additional steps at

    runtime to give yourapplication a performance

    boost.

    Being familiar with the java technology

    (2/2)

  • 8/11/2019 1.- About the Java Technology.pptx

    10/25

    The Java Platform

    Aplatformis the HW or SW environment in which

    a program runs (popular platforms are Windows,

    Linux, Solaris OS, Mac OS). Most platforms can be

    described as a combination of the operatingsystem and underlying hardware.

    The Java platform differs from most otherplatforms because its a software-only platform

  • 8/11/2019 1.- About the Java Technology.pptx

    11/25

    The Java platform

    Java platform has two components Java Virtual Machine (the base of

    the Java Platform)

    Java Application Programming

    Interface (API). The API is a large

    collection of ready-made

    software components that

    provide many useful capabilities.

    It is grouped into libraries of

    related classes and interfaces;

    these libraries are known as

    packages

  • 8/11/2019 1.- About the Java Technology.pptx

    12/25

    Object-Oriented Programming

    Concepts

    What is an Object?

    What is a Class?

    What is Inheritance?

    What is a Package

  • 8/11/2019 1.- About the Java Technology.pptx

    13/25

    What is an Object? 1/3

    Look around right now and youll find many examples of real-

    world objects (your dog, your desk, your bicycle)

    Real-world object share two characteristics: state(name, color, hungry)

    behavior (barking, fetching, wagging tail)

    Take a minute right now to observe the real-world objectsthat next to you. For each object, ask yourself two questions:

    What possible states can this object be in? What possible

    behavior can this object perform?

  • 8/11/2019 1.- About the Java Technology.pptx

    14/25

    What is an Object? (2/3)

    Software objects are similar to real-world objects, they too consist of

    state and related behavior.

    Objects store its state infields(variables

    in some programming languages) Objects exposes its behavior through

    methods(functions in some

    programming languages)

    Methodsoperate on an objects internal

    state and serve as the primarymechanism for object-to-object

    communication.

    Hiding internal state and requiring all

    interaction to be performed through an

    objects method is known as dataencapsulation

  • 8/11/2019 1.- About the Java Technology.pptx

    15/25

    What is an Object? (3/3)

    Using software objects provide the following

    benefits:

    Modularity: Source code for an object can be written and

    maintained independently of the source code for otherobjects

    Information-hiding: The detail of its internal

    implementation remain hidden from the outside world

    Code re-use: If an object already exists, you can use thatobject in your program

  • 8/11/2019 1.- About the Java Technology.pptx

    16/25

    What is a Class? (1/3)

    In the real world, youll often find many individual objects all

    of the same kind. There may be thousands of other bicycles in

    existence, all of the same model and make.

    Each bicycle was built from the same blueprints and therefore

    contains the same components

    In object-oriented terms, we say that your bicycle is an

    instanceof the class of objectsknown as bicycles.

    A classis the blueprint from which individual objects arecreated

  • 8/11/2019 1.- About the Java Technology.pptx

    17/25

    What is a Class? (2/3)

    Check the following Bicycle class

    class Bicycle {

    int cadence = 0;

    int speed = 0;

    int gear = 1;

    void changeCadence(int newValue) {

    cadence = newValue; }

    void changeGear(int newValue) {

    gear = newValue; }

    void speedUp(int increment) {

    speed = speed + increment; }

    void applyBrakes(int decrement) {

    speed = speed - decrement; }

    void printStates() {

    System.out.println("cadence:"+cadence+" speed:"+speed+" gear:"+gear);}

  • 8/11/2019 1.- About the Java Technology.pptx

    18/25

    What is a class? (3/3)

    Here is a BicycleDemoclass that creates two separate Bicycle

    objects and invokes their methods:

    class BicycleDemo {

    public static void main(String[] args) {

    // Create two different Bicycle objects

    Bicycle bike1 = new Bicycle();

    Bicycle bike2 = new Bicycle();

    // Invoke methods on those objects

    bike1.changeCadence(50);

    bike1.speedUp(10);

    bike1.changeGear(2);bike1.printStates();

    bike2.changeCadence(50);

    bike2.speedUp(10);

    bike2.changeGear(2);

    bike2.changeCadence(40);

    bike2.speedUp(20);

    bike2.changeGear(3);

    bike2.printStates(); }

    }

  • 8/11/2019 1.- About the Java Technology.pptx

    19/25

    What is Inheritance? (1/3)

    Different kinds of objects often have a certain amount in

    common with each other. Mountain bikes, road bikes and

    tandem bikes, for example all share the characteristics of

    bicycles. Yet each also defines additional features that make

    them differente: tandem bicycles: two seats & two sets of handlebars

    road bikes : drop handlebars

    mountain bikes: additional chain ring giving them a lower gear ratio

    Object-oriented programming allow classes to inheritcommonly used state and behavior from other classes.

    Bicyclebecomes a superclassof MountainBike, RoadBike, and

    TandemBike

  • 8/11/2019 1.- About the Java Technology.pptx

    20/25

    What is Inheritance? (2/3)

    In Java programming language, each class is allowed to have

    one direct superclass and each superclasshas the potential

    for an unlimited number of subclasses

  • 8/11/2019 1.- About the Java Technology.pptx

    21/25

    What is Inheritance? (3/3)

    The syntax for creating a subclass is simple. At the beginning

    of your class declaration, use the extendskeyword, followed

    by the name of the class to inherit from:

    class MountainBike extendsBicycle {

    // new fields and methods defining a mountain bike would go here

    }

    This gives MountainBikeall the same fields and methods as

    Bicycle, yet allows its code to focus exclusively on the featuresthat make it unique.

  • 8/11/2019 1.- About the Java Technology.pptx

    22/25

    What is an Interface?

    As you ve already learned, objects define their interaction with theoutside world through the methods that they expose.

    Methods form the objects interfacewith the outside world.

    In its most common form, an interface is a group of related methods with

    empty bodies.

    A bicycles behavior, if specified as an interface, migh appear as follows:interface Bicycle {

    void changeCadence(int newValue); // wheel revolutions p/m

    void changeGear(int newValue);

    void speedUp(int increment);

    void applyBrakes(int decrement);

    }

    Implementing an interface allows a class to become more formal about

    the behavior it promises to provide. Interfaces form a contract between

    the class an the outside world, and this contract is enforced at build time

    by the compiler.

  • 8/11/2019 1.- About the Java Technology.pptx

    23/25

    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. You might keep HTML pages in one

    folder, images in another, and scripts or applications in yet another.

    As software written in the Java programming language can be composed

    of hundreds or thousands of individual classes , it makes sense to keep

    things organized by placing related classes and interfaces into packages

    The Java platfom provides an enormous class library (a set of packages)

    suitable for use in your own applications. This library is known as the

    ApplicationsProgramming Interface(API)

  • 8/11/2019 1.- About the Java Technology.pptx

    24/25

    Questions

    1. Real-world objects contain ____ and ____.

    2. A software objects state is stored in ____.

    3. A software objects behavior is exposed through ________.

    4. Hiding internal data from the outside world, and accessing it only through publiclyexposed methods is known as data _______

    5. A blueprint for a sofware object is called a ____

    6. Common behavior can be defined in a___ and inherited into a ____ using the _____

    keyword

    7. A collection of methos with no implementation is called an ______.

    8. A namespace that organizes classes and interfaces by functionality is called a ____

    9. Ther term API stands for ____?

  • 8/11/2019 1.- About the Java Technology.pptx

    25/25

    Bibliografa

    http://download.oracle.com/javase/tutorial/java/concepts/index.html