SlideShare a Scribd company logo
1 of 131
Download to read offline
Java How to Program, 9/e
©1992-2012 by Pearson Education, Inc. All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Java is the world’s most widely used computer
programming language.
 You’ll learn to write instructions commanding
computers to perform tasks.
 Software (i.e., the instructions you write) controls
hardware (i.e., computers).
 You’ll learn object-oriented programming—today’s
key programming methodology.
 You’ll create and work with many software objects in
this text.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Java is the preferred language for meeting many
organizations’ enterprise programming needs.
 Java has become the language of choice for
implementing Internet-based applications and software
for devices that communicate over a network.
 In use today are more than a billion general-purpose
computers and billions more Java-enabled cell phones,
smartphones and handheld devices (such as tablet
computers).
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 The number of mobile Internet users will reach
approximately 134 million by 2013.
 Smartphone sales are projected to surpass personal
computer sales in 2011 and tablet sales to account for
over 20% of all personal computer sales by 2015.
 By 2014, the smartphone applications market is
expected to exceed $40 billion, which is creating
significant opportunities for programming mobile
applications.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Java Editions: SE, EE and ME
◦ Covers Java Standard Edition 6 (Java SE 6) with optional
modules on the new features of Java SE 7
◦ Used for developing cross-platform, general-purpose
applications.
◦ Java is used in such a broad spectrum of applications that it has
two other editions.
◦ The Java Enterprise Edition (Java EE)
◦ Geared toward developing large-scale, distributed networking
applications and web-based applications.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ Java Micro Edition (Java ME)
◦ geared toward developing applications for small, memory-
constrained devices, such as BlackBerry smartphones.
◦ Google’s Android operating system
◦ used on numerous smartphones, tablets (small, lightweight
mobile computers with touch screens), e-readers and other
devices—uses a customized version of Java not based on Java
ME.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Computing in Industry and Research
◦ Many of the most influential and successful businesses of the last
two decades are technology companies, including Apple, IBM,
Hewlett Packard, Dell, Intel, Motorola, Cisco, Microsoft, Google,
Amazon, Facebook, Twitter, Groupon, Foursquare, Yahoo!, eBay and
many more
◦ These are major employers of people who study computer science,
information systems or related disciplines.
◦ Computers are used extensively in academic and industrial research.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Computer—Device that can perform computations and
make logical decisions phenomenally faster than human
beings can.
 Today’s personal computers can perform billions of
calculations in one second—more than a human can
perform in a lifetime.
 Supercomputers are already performing thousands of
trillions (quadrillions) of instructions per second!
 Computers process data under the control of sets of
instructions called computer programs.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 These programs guide the computer through orderly sets of
actions specified by people called computer programmers.
 The programs that run on a computer are referred to as
software.
 You’ll learn today’s key programming methodology that’s
enhancing programmer productivity, thereby reducing
software-development costs—object-oriented programming.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 A computer consists of various devices referred to as
hardware
◦ (e.g., the keyboard, screen, mouse, hard disks, memory, DVDs and
processing units).
 Computing costs are dropping dramatically, owing to rapid
developments in hardware and software technologies.
 Computers that might have filled large rooms and cost
millions of dollars decades ago are now inscribed on silicon
chips smaller than a fingernail, costing perhaps a few
dollars each.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Silicon-chip technology has made computing so economical that
more than a billion general-purpose computers are in use
worldwide, and this is expected to double in the next few years.
 Computer chips (microprocessors) control countless devices.
 Embedded systems include anti-lock brakes in cars, navigation
systems, smart home appliances, home security systems, cell
phones and smartphones, robots, intelligent traffic intersections,
collision avoidance systems, video game controllers and more.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 The vast majority of the microprocessors produced
each year are embedded in devices other than general-
purpose computers.
 Moore’s Law
◦ For many decades, hardware costs have fallen rapidly.
◦ Every year or two, the capacities of computers have
approximately doubled without any increase in price.
◦ Observation often is called Moore’s Law.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ Named for the person who identified the trend, Gordon Moore,
co-founder of Intel.
◦ Moore’s Law and related observations are especially true in
relation to the amount of memory that computers have for
programs, the amount of secondary storage (such as disk
storage) they have to hold programs and data over longer
periods of time, and their processor speeds—the speeds at
which computers execute their programs (i.e., do their work).
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ Similar growth has occurred in the communications field
◦ Costs have plummeted as enormous demand for
communications bandwidth has attracted intense competition.
◦ Such phenomenal improvement is fostering the Information
Revolution.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Data items processed by computers form a data
hierarchy that becomes larger and more complex in
structure as we progress from bits to characters to fields,
and so on.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Computers can be envisioned as divided into various
logical units or sections.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Programmers write instructions in various
programming languages, some directly understandable
by computers and others requiring intermediate
translation steps.
 These may be divided into three general types:
◦ Machine languages
◦ Assembly languages
◦ High-level languages
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Any computer can directly understand only its own machine
language, defined by its hardware design.
◦ Generally consist of strings of numbers (ultimately reduced to 1s and 0s)
that instruct computers to perform their most elementary operations one
at a time.
◦ Machine dependent—a particular ma-chine language can be used on
only one type of computer.
 English-like abbreviations that represent elementary operations
formed the basis of assembly languages.
 Translator programs called assemblers convert early assembly-
language programs to machine language.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 High-level languages
◦ Single statements accomplish substantial tasks.
◦ Compilers convert high-level language programs into machine language.
◦ Allow you to write instructions that look almost like everyday English and
contain commonly used mathematical notations.
◦ A payroll program written in a high-level language might contain a single
statement such as
 grossPay = basePay + overTimePay
 Compiling a high-level language program into machine language can
take a considerable amount of computer time.
 Interpreter programs execute high-level language programs directly,
although slower than compiled programs run.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Objects, or more precisely, the classes objects come from, are
essentially reusable software components.
◦ There are date objects, time objects, audio objects, video objects, automobile
objects, people objects, etc.
◦ Almost any noun can be reasonably represented as a software object in terms of
attributes (e.g., name, color and size) and behaviors (e.g., calculating, moving
and communicating).
 Using a modular, object-oriented design and implementation approach
can make software-development groups much more productive than
was possible with earlier popular techniques like “structured
programming”—object-oriented programs are often eas-ier to
understand, correct and modify.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 The Automobile as an Object
◦ Let’s begin with a simple analogy.
◦ Suppose you want to drive a car and make it go faster by pressing its
accelerator pedal.
◦ Before you can drive a car, someone has to design it.
◦ A car typically begins as engineering drawings, similar to the blueprints
that describe the design of a house.
◦ Drawings include the design for an accelerator pedal.
◦ Pedal hides from the driver the complex mechanisms that actually make
the car go faster, just as the brake pedal hides the mechanisms that slow
the car, and the steering wheel “hides” the mechanisms that turn the car.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ Enables people with little or no knowledge of how engines,
braking and steering mechanisms work to drive a car easily.
◦ Before you can drive a car, it must be built from the
engineering drawings that describe it.
◦ A completed car has an actual accelerator pedal to make the
car go faster, but even that’s not enough—the car won’t
accelerate on its own (hopefully!), so the driver must press the
pedal to accelerate the car.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Methods and Classes
◦ Performing a task in a program requires a method.
◦ The method houses the program statements that actually perform its
tasks.
◦ Hides these statements from its user, just as the accelerator pedal of a
car hides from the driver the mechanisms of making the car go faster.
◦ In Java, we create a program unit called a class to house the set of
methods that perform the class’s tasks.
◦ A class is similar in concept to a car’s engineering drawings, which
house the design of an accelerator pedal, steering wheel, and so on.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Instantiation
◦ Just as someone has to build a car from its engineering
drawings before you can actually drive a car, you must build an
object of a class before a program can perform the tasks that
the class’s methods define.
◦ An object is then referred to as an instance of its class.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Reuse
◦ Just as a car’s engineering drawings can be reused many times to build
many cars, you can reuse a class many times to build many objects.
◦ Reuse of existing classes when building new classes and programs saves
time and effort.
◦ Reuse also helps you build more reliable and effective systems, because
existing classes and components often have gone through extensive
testing, debugging and performance tuning.
◦ Just as the notion of interchangeable parts was crucial to the Industrial
Revolution, reusable classes are crucial to the software revolution that
has been spurred by object technology.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Messages and Methods Calls
◦ When you drive a car, pressing its gas pedal sends a message
to the car to perform a task—that is, to go faster.
◦ Similarly, you send messages to an object.
◦ Each message is implemented as a method call that tells a
method of the object to perform its task.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Attributes and Instance Variables
◦ A car has attributes
◦ Color, its number of doors, the amount of gas in its tank, its
current speed and its record of total miles driven (i.e., its
odometer reading).
◦ The car’s attributes are represented as part of its design in its
engineering diagrams.
◦ Every car maintains its own attributes.
◦ Each car knows how much gas is in its own gas tank, but not
how much is in the tanks of other cars.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ An object, has attributes that it carries along as it’s used in a
program.
◦ Specified as part of the object’s class.
◦ A bank account object has a balance attribute that represents
the amount of money in the account.
◦ Each bank account object knows the balance in the account it
represents, but not the balances of the other accounts in the
bank.
◦ Attributes are specified by the class’s instance variables.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Encapsulation
◦ Classes encapsulate (i.e., wrap) attributes and methods into
objects—an object’s attributes and methods are intimately
related.
◦ Objects may communicate with one another, but they’re
normally not allowed to know how other objects are
implemented—implementation details are hidden within the
objects themselves.
◦ Information hiding, as we’ll see, is crucial to good software
engineering.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Inheritance
◦ A new class of objects can be created quickly and conveniently
by inheritance—the new class absorbs the characteristics of an
existing class, possibly customizing them and adding unique
characteristics of its own.
◦ In our car analogy, an object of class “convertible” certainly is
an object of the more general class “automobile,” but more
specifically, the roof can be raised or lowered.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Object-Oriented Analysis and Design (OOAD)
◦ How will you create the code (i.e., the program instructions)
for your programs?
◦ Follow a detailed analysis process for determining your
project’s requirements (i.e., defining what the system is
supposed to do)
◦ Develop a design that satisfies them (i.e., deciding how the
system should do it).
◦ Carefully review the design (and have your design reviewed by
other software professionals) before writing any code.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ Analyzing and designing your system from an object-oriented
point of view is called an object-oriented analysis and design
(OOAD) process.
◦ Languages like Java are object oriented.
◦ Object-oriented programming (OOP) allows you to implement
an object-oriented design as a working system.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 The UML (Unified Modeling Language)
◦ The Unified Modeling Language (UML) is the most widely
used graphical scheme for modeling object-oriented systems.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Operating systems
◦ Software systems that make using computers more convenient.
◦ Provide services that allow each application to execute safely,
efficiently and concurrently (i.e., in parallel) with other
applications.
◦ The software that contains the core components of the
operating system is called the kernel.
◦ Popular desktop operating systems include Linux, Windows 7
and Mac OS X.
◦ Popular mobile operating systems used in smartphones and
tablets include Google’s Android, BlackBerry OS and Apple’s
iOS (for its iPhone, iPad and iPod Touch devices).
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Windows—A Proprietary Operating System
◦ Mid-1980s: Microsoft developed the Windows operating
system, consisting of a graphical user interface built on top of
DOS—an enormously popular personal-computer operating
system of the time that users interacted with by typing
commands.
◦ Windows borrowed from many concepts (such as icons, menus
and windows) popularized by early Apple Macintosh operating
systems and originally developed by Xerox PARC.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ Windows 7, Microsoft’s latest operating system, features
enhancements to the user interface, faster startup times, further
refinement of security features, touch-screen and multi-touch
support, and more.
◦ Windows is a proprietary operating system—it’s controlled by
one company exclusively.
◦ Windows is by far the world’s most widely used operating
system.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Linux—An Open-Source Operating System
 Open-source software
◦ A software development style that departs from the proprietary
development that dominated software’s early years.
◦ Individuals and companies contribute their efforts in
developing, maintaining and evolving software in exchange for
the right to use that software for their own purposes, typically
at no charge.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ Eclipse Foundation (the Eclipse Integrated Development
Environment helps Java programmers conveniently develop
software)
◦ Mozilla Foundation (creators of the Firefox web browser)
◦ Apache Software Foundation (creators of the Apache web
server)
◦ SourceForge (which provides the tools for managing open
source projects—it has over 260,000 of them under
development).
◦ Facebook, which was launched from a college dorm room and
built with open-source software.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Linux
◦ The most popular open-source operating system.
◦ Developed by volunteers
◦ Popular in servers, personal computers and embedded systems.
◦ Source code is available to the public for examination and
modification
◦ Free to download and install.
◦ Ability to completely customize the operating system to meet
specific needs.
◦ 1991: Linus Torvalds began developing the Linux kernel.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ The name is derived from “Linus” and “UNIX”—an operating
system developed by Bell Labs in 1969.
◦ Favorable response led to the creation of a community that has
continued to develop and support Linux.
◦ Developers downloaded, tested, and modified the Linux code,
submitting bug fixes and feedback to Torvalds, who reviewed
them and applied the improvements to the code.
◦ The 1994 release of Linux included features found in a mature
operating system, making Linux a viable alternative to UNIX.
◦ Extremely popular on servers and in embedded systems, such
as Android-based smartphones.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Android
◦ Fastest growing mobile and smartphone operating system
◦ Based on the Linux kernel and Java.
◦ Open source and free.
◦ Developed by Android, Inc., which was acquired by Google in
2005.
◦ As of December 2010, more than 300,000 Android
smartphones were being activated each day.
◦ Android smartphones are now outselling iPhones.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ Android operating system is used in numerous smartphones, e-
reader devices, tablet computers, in-store touch-screen kiosks,
cars, robots and multimedia players.
◦ Android smartphones include the functionality of a mobile
phone, Internet client (for web browsing and Internet
communication), MP3 player, gaming console, digital camera
and more, wrapped into handheld devices with full-color
multitouch screens—these allow you to control the device with
gestures involving one touch or multiple simultaneous touches.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Android App-Development Chapters on the
Companion Website
◦ The book’s companion website includes a three-chapter
introduction to Android app development from the book,
Android for Programmers: An App-Driven Approach.
◦ After you learn Java, you’ll find it straightforward to begin
developing and running Android apps.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Microprocessors are having a profound impact in
intelligent consumer-electronic devices.
 1991
◦ Recognizing this, Sun Microsystems funded an internal
corporate research project led by James Gosling, which
resulted in a C++-based object-oriented programming language
Sun called Java.
◦ Key goal of Java is to be able to write programs that will run
on a great variety of computer systems and computer-control
devices.
◦ This is sometimes called “write once, run anywhere.”
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 1993
◦ The web exploded in popularity
◦ Sun saw the potential of using Java to add dynamic content to
web pages.
 Java garnered the attention of the business community
because of the phenomenal interest in the web.
 Java is used to develop large-scale enterprise
applications, to enhance the functionality of web
servers, to provide applications for consumer devices
and for many other purposes.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Sun Microsystems was acquired by Oracle in 2009.
 As of 2010 97% of enterprise desktops, three billion
handsets, and 80 million television devices run Java.
 Java is the most widely used software development
language in the world.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Java Class Libraries
◦ Rich collections of existing classes and methods
◦ Also known as the Java APIs (Application Programming
Interfaces).
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Java programs normally go through five phases
◦ edit
◦ compile
◦ load
◦ verify
◦ execute.
 Download the JDK and its documentation from
◦ www.oracle.com/technetwork/java/javase/downloads
/index.html.
 Read the Before You Begin section of this book to ensure that
you set up your computer properly to compile and execute Java
programs.
 Visit Oracle’s New to Java Center at:
 www.oracle.com/technetwork/topics/newtojava/overview
/index.html
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Phase 1 consists of editing a file with an I
◦ Type a Java program (source code) using the editor.
◦ Make any necessary corrections.
◦ Save the program.
◦ A file name ending with the .java extension indicates that the
file contains Java source code.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Linux editors: vi and emacs.
 Windows editors:
◦ Notepad
◦ EditPlus (www.editplus.com)
◦ TextPad (www.textpad.com)
◦ jEdit (www.jedit.org).
 Integrated development environments (IDEs)
◦ Provide tools that support the software development process,
including editors for writing and editing programs and
debuggers for locating logic errors—errors that cause
programs to execute incorrectly.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Popular IDEs
◦ Eclipse (www.eclipse.org)
◦ NetBeans (www.netbeans.org).
◦ jGRASP™ IDE (www.jgrasp.org)
◦ DrJava IDE (www.drjava.org/download.shtml)
◦ BlueJ IDE (www.bluej.org/)
◦ TextPad® Text Editor for Windows® (www.textpad.com/)
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Phase 2: Compiling a Java Program into Bytecodes
◦ Use the command javac (the Java compiler) to compile a
program. For example, to compile a program called
Welcome.java, you’d type
 javac Welcome.java
◦ If the program compiles, the compiler produces a .class file
called Welcome.class that contains the compiled version
of the program.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Java compiler translates Java source code into bytecodes
that represent the tasks to execute.
 Bytecodes are executed by the Java Virtual Machine
(JVM)—a part of the JDK and the foundation of the Java
platform.
 Virtual machine (VM)—a software application that
simulates a computer
◦ Hides the underlying operating system and hardware from the
programs that interact with it.
 If the same VM is implemented on many computer
platforms, applications that it executes can be used on all
those platforms.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Bytecodes are platform independent
◦ They do not depend on a particular hardware platform.
 Bytecodes are portable
◦ The same bytecodes can execute on any platform containing a JVM
that understands the version of Java in which the bytecodes were
compiled.
 The JVM is invoked by the java command. For example, to
execute a Java application called Welcome, you’d type the
command
 java Welcome
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Phase 3: Loading a Program into Memory
◦ The JVM places the program in memory to execute it—this is
known as loading.
◦ Class loader takes the .class files containing the program’s
bytecodes and transfers them to primary memory.
◦ Also loads any of the .class files provided by Java that your
program uses.
 The .class files can be loaded from a disk on your
system or over a network.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Phase 4: Bytecode Verification
◦ As the classes are loaded, the bytecode verifier examines their
bytecodes
◦ Ensures that they’re valid and do not violate Java’s security
restrictions.
 Java enforces strong security to make sure that Java
programs arriving over the network do not damage
your files or your system (as computer viruses and
worms might).
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Phase 5: Execution
◦ The JVM executes the program’s bytecodes.
◦ JVMs typically execute bytecodes using a combination of
interpretation and so-called just-in-time (JIT) compilation.
◦ Analyzes the bytecodes as they’re interpreted
◦ A just-in-time (JIT) compiler—known as the Java HotSpot
compiler—translates the bytecodes into the underlying computer’s
machine language.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
◦ When the JVM encounters these compiled parts again, the faster
machine-language code executes.
◦ Java programs go through two compilation phases
◦ One in which source code is translated into bytecodes (for portability
across JVMs on different computer platforms) and
◦ A second in which, during execution, the bytecodes are translated
into machine language for the actual computer on which the program
executes.

©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Checking your setup. Read the Before You Begin
section of the book to confirm that you’ve set up Java
properly on your computer and that you’ve copied the
book’s examples to your hard drive.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 The web exploded in the mid-to-late 1990s, but the “dot com” economic bust
brought hard times in the early 2000s.
 Resurgence that began in 2004 or so has been named Web 2.0.
 Google is widely regarded as the signature company of Web 2.0.
 Some other companies with “Web 2.0 characteristics” are YouTube (video
sharing), FaceBook (social networking), Twitter (microblogging), Groupon
(social commerce), Foursquare (mobile check-in), Salesforce (business
software offered as online services), Craigslist (free classified listings), Flickr
(photo sharing), Second Life (a virtual world), Skype (Internet telephony) and
Wikipedia (a free online encyclopedia).
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Google
◦ In 1996, Stanford computer science Ph.D. candidates Larry Page and
Sergey Brin began collaborating on a new search engine.
◦ In 1997, they changed the name to Google—a play on the
mathematical term googol
◦ Google’s ability to return extremely accurate search results quickly
helped it become the most widely used search engine and one of the
most popular websites in the world.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Web Services and Mashups
◦ Mashup is an applications-development methodology in which
you can rapidly develop powerful and intriguing applications
by combining (often free) complementary web services and
other forms of information feeds.

©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Ajax
◦ One of the premier Web 2.0 software technologies.
◦ Helps Internet-based applications perform like desktop applications
◦ A difficult task, given that such applications suffer transmission
delays as data is shuttled back and forth between your computer and
server computers on the Internet.
◦ Applications like Google Maps have used Ajax to achieve excellent
performance and approach the look-and-feel of desktop applications.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
 Social Applications
◦ Over the last several years, there’s been a tremendous increase
in the number of social applications on the web.
◦ These sites were able to become phenomenally successful in a
relatively short period of time.

©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.

©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.
©1992-2012 by Pearson Education, Inc.
All Rights Reserved.

More Related Content

What's hot

Lesson 1 introduction to computers
Lesson 1 introduction to computersLesson 1 introduction to computers
Lesson 1 introduction to computerssir-smartt
 
Title 09 - computer application in media industries (2)
Title   09 - computer application in media industries (2)Title   09 - computer application in media industries (2)
Title 09 - computer application in media industries (2)Adzline Nurul
 
Databases & Challenges of a Digital Age
Databases & Challenges of a Digital AgeDatabases & Challenges of a Digital Age
Databases & Challenges of a Digital AgeWendy Lile
 
Introduction to information technology
Introduction to information technologyIntroduction to information technology
Introduction to information technologyHaider Ali Malik
 
T1 [intro to computer]
T1 [intro to computer]T1 [intro to computer]
T1 [intro to computer]ICAM
 
Ch01 Digital Literacy: Introducting a World of Technology
Ch01 Digital Literacy: Introducting a World of TechnologyCh01 Digital Literacy: Introducting a World of Technology
Ch01 Digital Literacy: Introducting a World of TechnologyDagny Sue Elwood
 
Ict form 4 chapter 1(answer)
Ict form 4 chapter 1(answer)Ict form 4 chapter 1(answer)
Ict form 4 chapter 1(answer)smkengkilili2011
 
Chapter 8 Digital Storage
Chapter 8 Digital StorageChapter 8 Digital Storage
Chapter 8 Digital Storagextin101
 
Introduction to information technology lecture 1
Introduction to information technology   lecture 1Introduction to information technology   lecture 1
Introduction to information technology lecture 1CBAKhan
 
Intro to computers ch 1
Intro to computers ch 1Intro to computers ch 1
Intro to computers ch 1Vanita
 
IMPACT OF TECHNOLOGY ON BUSINESS COMMUNICATION
IMPACT OF TECHNOLOGY ON BUSINESS COMMUNICATIONIMPACT OF TECHNOLOGY ON BUSINESS COMMUNICATION
IMPACT OF TECHNOLOGY ON BUSINESS COMMUNICATIONAbdur Rakib
 
Computer literacy
Computer literacyComputer literacy
Computer literacyPaulyn Go
 
Importance of computer in professional life
Importance of computer in professional lifeImportance of computer in professional life
Importance of computer in professional lifeVïpĭn Râẁât
 

What's hot (20)

Lesson 1 introduction to computers
Lesson 1 introduction to computersLesson 1 introduction to computers
Lesson 1 introduction to computers
 
Title 09 - computer application in media industries (2)
Title   09 - computer application in media industries (2)Title   09 - computer application in media industries (2)
Title 09 - computer application in media industries (2)
 
Databases & Challenges of a Digital Age
Databases & Challenges of a Digital AgeDatabases & Challenges of a Digital Age
Databases & Challenges of a Digital Age
 
Introduction to information technology
Introduction to information technologyIntroduction to information technology
Introduction to information technology
 
Botany Software
Botany SoftwareBotany Software
Botany Software
 
T1 [intro to computer]
T1 [intro to computer]T1 [intro to computer]
T1 [intro to computer]
 
Ict tools used in education
Ict tools used in educationIct tools used in education
Ict tools used in education
 
Ch01 Digital Literacy: Introducting a World of Technology
Ch01 Digital Literacy: Introducting a World of TechnologyCh01 Digital Literacy: Introducting a World of Technology
Ch01 Digital Literacy: Introducting a World of Technology
 
Ict tools
Ict tools Ict tools
Ict tools
 
Ict form 4 chapter 1(answer)
Ict form 4 chapter 1(answer)Ict form 4 chapter 1(answer)
Ict form 4 chapter 1(answer)
 
B.Ed class-1
B.Ed class-1B.Ed class-1
B.Ed class-1
 
Chapter 8 Digital Storage
Chapter 8 Digital StorageChapter 8 Digital Storage
Chapter 8 Digital Storage
 
Computer literacy
Computer literacyComputer literacy
Computer literacy
 
Computer
ComputerComputer
Computer
 
Introduction to information technology lecture 1
Introduction to information technology   lecture 1Introduction to information technology   lecture 1
Introduction to information technology lecture 1
 
Uses
UsesUses
Uses
 
Intro to computers ch 1
Intro to computers ch 1Intro to computers ch 1
Intro to computers ch 1
 
IMPACT OF TECHNOLOGY ON BUSINESS COMMUNICATION
IMPACT OF TECHNOLOGY ON BUSINESS COMMUNICATIONIMPACT OF TECHNOLOGY ON BUSINESS COMMUNICATION
IMPACT OF TECHNOLOGY ON BUSINESS COMMUNICATION
 
Computer literacy
Computer literacyComputer literacy
Computer literacy
 
Importance of computer in professional life
Importance of computer in professional lifeImportance of computer in professional life
Importance of computer in professional life
 

Viewers also liked

14장 - 15장 예외처리, 템플릿
14장 - 15장 예외처리, 템플릿14장 - 15장 예외처리, 템플릿
14장 - 15장 예외처리, 템플릿유석 남
 
[아꿈사] The C++ Programming Language 11장 연산자 오버로딩
[아꿈사] The C++ Programming Language 11장 연산자 오버로딩[아꿈사] The C++ Programming Language 11장 연산자 오버로딩
[아꿈사] The C++ Programming Language 11장 연산자 오버로딩해강
 
02장 Introduction to Java Applications
02장 Introduction to Java Applications02장 Introduction to Java Applications
02장 Introduction to Java Applications유석 남
 
13장 연산자 오버로딩
13장 연산자 오버로딩13장 연산자 오버로딩
13장 연산자 오버로딩유석 남
 
[20140624]소개자료
[20140624]소개자료[20140624]소개자료
[20140624]소개자료유석 남
 
12장 상속 (고급)
12장 상속 (고급)12장 상속 (고급)
12장 상속 (고급)유석 남
 

Viewers also liked (6)

14장 - 15장 예외처리, 템플릿
14장 - 15장 예외처리, 템플릿14장 - 15장 예외처리, 템플릿
14장 - 15장 예외처리, 템플릿
 
[아꿈사] The C++ Programming Language 11장 연산자 오버로딩
[아꿈사] The C++ Programming Language 11장 연산자 오버로딩[아꿈사] The C++ Programming Language 11장 연산자 오버로딩
[아꿈사] The C++ Programming Language 11장 연산자 오버로딩
 
02장 Introduction to Java Applications
02장 Introduction to Java Applications02장 Introduction to Java Applications
02장 Introduction to Java Applications
 
13장 연산자 오버로딩
13장 연산자 오버로딩13장 연산자 오버로딩
13장 연산자 오버로딩
 
[20140624]소개자료
[20140624]소개자료[20140624]소개자료
[20140624]소개자료
 
12장 상속 (고급)
12장 상속 (고급)12장 상속 (고급)
12장 상속 (고급)
 

Similar to 01장 Introduction to Computers and Java

IS Project_Ch5_IT_Infrastructure.pptx
IS Project_Ch5_IT_Infrastructure.pptxIS Project_Ch5_IT_Infrastructure.pptx
IS Project_Ch5_IT_Infrastructure.pptxAbbadabbajabba1
 
ICT, Importance of programming and programming languages
ICT, Importance of programming and programming languagesICT, Importance of programming and programming languages
ICT, Importance of programming and programming languagesEbin Robinson
 
iw3htp4_01-FINAL.ppt
iw3htp4_01-FINAL.pptiw3htp4_01-FINAL.ppt
iw3htp4_01-FINAL.pptlucky sharma
 
jhtp8_ch01.ppt
jhtp8_ch01.pptjhtp8_ch01.ppt
jhtp8_ch01.pptKPKumar15
 
Technology Infrastructure For The Pervasive Vision, Does It Exist Yet?
Technology Infrastructure For The Pervasive Vision, Does It Exist Yet?Technology Infrastructure For The Pervasive Vision, Does It Exist Yet?
Technology Infrastructure For The Pervasive Vision, Does It Exist Yet?Olivia Moran
 
Lecture3.pptx
Lecture3.pptxLecture3.pptx
Lecture3.pptxnassmah
 
APPLICATIONS AND DEVICES-DRIVERS REVIEW NOTES.pdf
APPLICATIONS AND DEVICES-DRIVERS REVIEW NOTES.pdfAPPLICATIONS AND DEVICES-DRIVERS REVIEW NOTES.pdf
APPLICATIONS AND DEVICES-DRIVERS REVIEW NOTES.pdfAirrahArishaPialaAlc
 
Using InduSoft Web Studio to Create HTML5 SCADA/HMI Graphics
Using InduSoft Web Studio to Create HTML5 SCADA/HMI GraphicsUsing InduSoft Web Studio to Create HTML5 SCADA/HMI Graphics
Using InduSoft Web Studio to Create HTML5 SCADA/HMI GraphicsAVEVA
 
Computer application in business
Computer application in businessComputer application in business
Computer application in businessManas Saha
 
Introduction to it application
Introduction to it applicationIntroduction to it application
Introduction to it applicationKumar
 
1. What is IT infrastructure and what are its components2.What ar.pdf
1. What is IT infrastructure and what are its components2.What ar.pdf1. What is IT infrastructure and what are its components2.What ar.pdf
1. What is IT infrastructure and what are its components2.What ar.pdfexpressionnoveltiesk
 

Similar to 01장 Introduction to Computers and Java (20)

IS Project_Ch5_IT_Infrastructure.pptx
IS Project_Ch5_IT_Infrastructure.pptxIS Project_Ch5_IT_Infrastructure.pptx
IS Project_Ch5_IT_Infrastructure.pptx
 
ICT, Importance of programming and programming languages
ICT, Importance of programming and programming languagesICT, Importance of programming and programming languages
ICT, Importance of programming and programming languages
 
CROSS PLATFORM APPLICATIONS DEVELOPMENT
CROSS PLATFORM APPLICATIONS DEVELOPMENT CROSS PLATFORM APPLICATIONS DEVELOPMENT
CROSS PLATFORM APPLICATIONS DEVELOPMENT
 
Technology update
Technology updateTechnology update
Technology update
 
Technology update
Technology updateTechnology update
Technology update
 
IT Technologies Career perspective
IT Technologies   Career perspectiveIT Technologies   Career perspective
IT Technologies Career perspective
 
iw3htp4_01-FINAL.ppt
iw3htp4_01-FINAL.pptiw3htp4_01-FINAL.ppt
iw3htp4_01-FINAL.ppt
 
jhtp8_ch01.ppt
jhtp8_ch01.pptjhtp8_ch01.ppt
jhtp8_ch01.ppt
 
Technology update
Technology updateTechnology update
Technology update
 
Technology Infrastructure For The Pervasive Vision, Does It Exist Yet?
Technology Infrastructure For The Pervasive Vision, Does It Exist Yet?Technology Infrastructure For The Pervasive Vision, Does It Exist Yet?
Technology Infrastructure For The Pervasive Vision, Does It Exist Yet?
 
Lecture3.pptx
Lecture3.pptxLecture3.pptx
Lecture3.pptx
 
APPLICATIONS AND DEVICES-DRIVERS REVIEW NOTES.pdf
APPLICATIONS AND DEVICES-DRIVERS REVIEW NOTES.pdfAPPLICATIONS AND DEVICES-DRIVERS REVIEW NOTES.pdf
APPLICATIONS AND DEVICES-DRIVERS REVIEW NOTES.pdf
 
C programming Introduction
C programming IntroductionC programming Introduction
C programming Introduction
 
Using InduSoft Web Studio to Create HTML5 SCADA/HMI Graphics
Using InduSoft Web Studio to Create HTML5 SCADA/HMI GraphicsUsing InduSoft Web Studio to Create HTML5 SCADA/HMI Graphics
Using InduSoft Web Studio to Create HTML5 SCADA/HMI Graphics
 
Computer application in business
Computer application in businessComputer application in business
Computer application in business
 
MSCIT Unit 1
MSCIT Unit 1MSCIT Unit 1
MSCIT Unit 1
 
Ahmadalsawad
AhmadalsawadAhmadalsawad
Ahmadalsawad
 
POWERPOINT2
POWERPOINT2POWERPOINT2
POWERPOINT2
 
Introduction to it application
Introduction to it applicationIntroduction to it application
Introduction to it application
 
1. What is IT infrastructure and what are its components2.What ar.pdf
1. What is IT infrastructure and what are its components2.What ar.pdf1. What is IT infrastructure and what are its components2.What ar.pdf
1. What is IT infrastructure and what are its components2.What ar.pdf
 

More from 유석 남

11장 상속
11장 상속11장 상속
11장 상속유석 남
 
10장 문자열 클래스와 파일 클래스
10장 문자열 클래스와 파일 클래스10장 문자열 클래스와 파일 클래스
10장 문자열 클래스와 파일 클래스유석 남
 
09장 객체와 클래스 (고급)
09장 객체와 클래스 (고급)09장 객체와 클래스 (고급)
09장 객체와 클래스 (고급)유석 남
 
08장 객체와 클래스 (기본)
08장 객체와 클래스 (기본)08장 객체와 클래스 (기본)
08장 객체와 클래스 (기본)유석 남
 
05장 논리적 자료표현: 구조체
05장 논리적 자료표현: 구조체05장 논리적 자료표현: 구조체
05장 논리적 자료표현: 구조체유석 남
 
04장 고급변수 사용
04장 고급변수 사용04장 고급변수 사용
04장 고급변수 사용유석 남
 
03장 조건문, 반복문, 네임스페이스
03장 조건문, 반복문, 네임스페이스03장 조건문, 반복문, 네임스페이스
03장 조건문, 반복문, 네임스페이스유석 남
 

More from 유석 남 (9)

11장 상속
11장 상속11장 상속
11장 상속
 
10장 문자열 클래스와 파일 클래스
10장 문자열 클래스와 파일 클래스10장 문자열 클래스와 파일 클래스
10장 문자열 클래스와 파일 클래스
 
09장 객체와 클래스 (고급)
09장 객체와 클래스 (고급)09장 객체와 클래스 (고급)
09장 객체와 클래스 (고급)
 
08장 객체와 클래스 (기본)
08장 객체와 클래스 (기본)08장 객체와 클래스 (기본)
08장 객체와 클래스 (기본)
 
06장 함수
06장 함수06장 함수
06장 함수
 
05장 논리적 자료표현: 구조체
05장 논리적 자료표현: 구조체05장 논리적 자료표현: 구조체
05장 논리적 자료표현: 구조체
 
04장 고급변수 사용
04장 고급변수 사용04장 고급변수 사용
04장 고급변수 사용
 
03장 조건문, 반복문, 네임스페이스
03장 조건문, 반복문, 네임스페이스03장 조건문, 반복문, 네임스페이스
03장 조건문, 반복문, 네임스페이스
 
Example
ExampleExample
Example
 

Recently uploaded

Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 

Recently uploaded (20)

Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 

01장 Introduction to Computers and Java

  • 1. Java How to Program, 9/e ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 2. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 3. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 4.  Java is the world’s most widely used computer programming language.  You’ll learn to write instructions commanding computers to perform tasks.  Software (i.e., the instructions you write) controls hardware (i.e., computers).  You’ll learn object-oriented programming—today’s key programming methodology.  You’ll create and work with many software objects in this text. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 5.  Java is the preferred language for meeting many organizations’ enterprise programming needs.  Java has become the language of choice for implementing Internet-based applications and software for devices that communicate over a network.  In use today are more than a billion general-purpose computers and billions more Java-enabled cell phones, smartphones and handheld devices (such as tablet computers). ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 6.  The number of mobile Internet users will reach approximately 134 million by 2013.  Smartphone sales are projected to surpass personal computer sales in 2011 and tablet sales to account for over 20% of all personal computer sales by 2015.  By 2014, the smartphone applications market is expected to exceed $40 billion, which is creating significant opportunities for programming mobile applications. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 7.  Java Editions: SE, EE and ME ◦ Covers Java Standard Edition 6 (Java SE 6) with optional modules on the new features of Java SE 7 ◦ Used for developing cross-platform, general-purpose applications. ◦ Java is used in such a broad spectrum of applications that it has two other editions. ◦ The Java Enterprise Edition (Java EE) ◦ Geared toward developing large-scale, distributed networking applications and web-based applications. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 8. ◦ Java Micro Edition (Java ME) ◦ geared toward developing applications for small, memory- constrained devices, such as BlackBerry smartphones. ◦ Google’s Android operating system ◦ used on numerous smartphones, tablets (small, lightweight mobile computers with touch screens), e-readers and other devices—uses a customized version of Java not based on Java ME. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 9.  Computing in Industry and Research ◦ Many of the most influential and successful businesses of the last two decades are technology companies, including Apple, IBM, Hewlett Packard, Dell, Intel, Motorola, Cisco, Microsoft, Google, Amazon, Facebook, Twitter, Groupon, Foursquare, Yahoo!, eBay and many more ◦ These are major employers of people who study computer science, information systems or related disciplines. ◦ Computers are used extensively in academic and industrial research. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 10. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 11. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 12. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 13. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 14. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 15. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 16. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 17. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 18. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 19. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 20. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 21.  Computer—Device that can perform computations and make logical decisions phenomenally faster than human beings can.  Today’s personal computers can perform billions of calculations in one second—more than a human can perform in a lifetime.  Supercomputers are already performing thousands of trillions (quadrillions) of instructions per second!  Computers process data under the control of sets of instructions called computer programs. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 22.  These programs guide the computer through orderly sets of actions specified by people called computer programmers.  The programs that run on a computer are referred to as software.  You’ll learn today’s key programming methodology that’s enhancing programmer productivity, thereby reducing software-development costs—object-oriented programming. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 23.  A computer consists of various devices referred to as hardware ◦ (e.g., the keyboard, screen, mouse, hard disks, memory, DVDs and processing units).  Computing costs are dropping dramatically, owing to rapid developments in hardware and software technologies.  Computers that might have filled large rooms and cost millions of dollars decades ago are now inscribed on silicon chips smaller than a fingernail, costing perhaps a few dollars each. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 24.  Silicon-chip technology has made computing so economical that more than a billion general-purpose computers are in use worldwide, and this is expected to double in the next few years.  Computer chips (microprocessors) control countless devices.  Embedded systems include anti-lock brakes in cars, navigation systems, smart home appliances, home security systems, cell phones and smartphones, robots, intelligent traffic intersections, collision avoidance systems, video game controllers and more. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 25.  The vast majority of the microprocessors produced each year are embedded in devices other than general- purpose computers.  Moore’s Law ◦ For many decades, hardware costs have fallen rapidly. ◦ Every year or two, the capacities of computers have approximately doubled without any increase in price. ◦ Observation often is called Moore’s Law. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 26. ◦ Named for the person who identified the trend, Gordon Moore, co-founder of Intel. ◦ Moore’s Law and related observations are especially true in relation to the amount of memory that computers have for programs, the amount of secondary storage (such as disk storage) they have to hold programs and data over longer periods of time, and their processor speeds—the speeds at which computers execute their programs (i.e., do their work). ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 27. ◦ Similar growth has occurred in the communications field ◦ Costs have plummeted as enormous demand for communications bandwidth has attracted intense competition. ◦ Such phenomenal improvement is fostering the Information Revolution. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 28.  Data items processed by computers form a data hierarchy that becomes larger and more complex in structure as we progress from bits to characters to fields, and so on. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 29. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 30. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 31. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 32. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 33. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 34. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 35.  Computers can be envisioned as divided into various logical units or sections. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 36. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 37. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 38. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 39. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 40. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 41. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 42.  Programmers write instructions in various programming languages, some directly understandable by computers and others requiring intermediate translation steps.  These may be divided into three general types: ◦ Machine languages ◦ Assembly languages ◦ High-level languages ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 43.  Any computer can directly understand only its own machine language, defined by its hardware design. ◦ Generally consist of strings of numbers (ultimately reduced to 1s and 0s) that instruct computers to perform their most elementary operations one at a time. ◦ Machine dependent—a particular ma-chine language can be used on only one type of computer.  English-like abbreviations that represent elementary operations formed the basis of assembly languages.  Translator programs called assemblers convert early assembly- language programs to machine language. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 44.  High-level languages ◦ Single statements accomplish substantial tasks. ◦ Compilers convert high-level language programs into machine language. ◦ Allow you to write instructions that look almost like everyday English and contain commonly used mathematical notations. ◦ A payroll program written in a high-level language might contain a single statement such as  grossPay = basePay + overTimePay  Compiling a high-level language program into machine language can take a considerable amount of computer time.  Interpreter programs execute high-level language programs directly, although slower than compiled programs run. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 45.  Objects, or more precisely, the classes objects come from, are essentially reusable software components. ◦ There are date objects, time objects, audio objects, video objects, automobile objects, people objects, etc. ◦ Almost any noun can be reasonably represented as a software object in terms of attributes (e.g., name, color and size) and behaviors (e.g., calculating, moving and communicating).  Using a modular, object-oriented design and implementation approach can make software-development groups much more productive than was possible with earlier popular techniques like “structured programming”—object-oriented programs are often eas-ier to understand, correct and modify. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 46.  The Automobile as an Object ◦ Let’s begin with a simple analogy. ◦ Suppose you want to drive a car and make it go faster by pressing its accelerator pedal. ◦ Before you can drive a car, someone has to design it. ◦ A car typically begins as engineering drawings, similar to the blueprints that describe the design of a house. ◦ Drawings include the design for an accelerator pedal. ◦ Pedal hides from the driver the complex mechanisms that actually make the car go faster, just as the brake pedal hides the mechanisms that slow the car, and the steering wheel “hides” the mechanisms that turn the car. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 47. ◦ Enables people with little or no knowledge of how engines, braking and steering mechanisms work to drive a car easily. ◦ Before you can drive a car, it must be built from the engineering drawings that describe it. ◦ A completed car has an actual accelerator pedal to make the car go faster, but even that’s not enough—the car won’t accelerate on its own (hopefully!), so the driver must press the pedal to accelerate the car. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 48.  Methods and Classes ◦ Performing a task in a program requires a method. ◦ The method houses the program statements that actually perform its tasks. ◦ Hides these statements from its user, just as the accelerator pedal of a car hides from the driver the mechanisms of making the car go faster. ◦ In Java, we create a program unit called a class to house the set of methods that perform the class’s tasks. ◦ A class is similar in concept to a car’s engineering drawings, which house the design of an accelerator pedal, steering wheel, and so on. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 49.  Instantiation ◦ Just as someone has to build a car from its engineering drawings before you can actually drive a car, you must build an object of a class before a program can perform the tasks that the class’s methods define. ◦ An object is then referred to as an instance of its class. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 50.  Reuse ◦ Just as a car’s engineering drawings can be reused many times to build many cars, you can reuse a class many times to build many objects. ◦ Reuse of existing classes when building new classes and programs saves time and effort. ◦ Reuse also helps you build more reliable and effective systems, because existing classes and components often have gone through extensive testing, debugging and performance tuning. ◦ Just as the notion of interchangeable parts was crucial to the Industrial Revolution, reusable classes are crucial to the software revolution that has been spurred by object technology. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 51. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 52.  Messages and Methods Calls ◦ When you drive a car, pressing its gas pedal sends a message to the car to perform a task—that is, to go faster. ◦ Similarly, you send messages to an object. ◦ Each message is implemented as a method call that tells a method of the object to perform its task. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 53.  Attributes and Instance Variables ◦ A car has attributes ◦ Color, its number of doors, the amount of gas in its tank, its current speed and its record of total miles driven (i.e., its odometer reading). ◦ The car’s attributes are represented as part of its design in its engineering diagrams. ◦ Every car maintains its own attributes. ◦ Each car knows how much gas is in its own gas tank, but not how much is in the tanks of other cars. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 54. ◦ An object, has attributes that it carries along as it’s used in a program. ◦ Specified as part of the object’s class. ◦ A bank account object has a balance attribute that represents the amount of money in the account. ◦ Each bank account object knows the balance in the account it represents, but not the balances of the other accounts in the bank. ◦ Attributes are specified by the class’s instance variables. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 55.  Encapsulation ◦ Classes encapsulate (i.e., wrap) attributes and methods into objects—an object’s attributes and methods are intimately related. ◦ Objects may communicate with one another, but they’re normally not allowed to know how other objects are implemented—implementation details are hidden within the objects themselves. ◦ Information hiding, as we’ll see, is crucial to good software engineering. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 56.  Inheritance ◦ A new class of objects can be created quickly and conveniently by inheritance—the new class absorbs the characteristics of an existing class, possibly customizing them and adding unique characteristics of its own. ◦ In our car analogy, an object of class “convertible” certainly is an object of the more general class “automobile,” but more specifically, the roof can be raised or lowered. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 57.  Object-Oriented Analysis and Design (OOAD) ◦ How will you create the code (i.e., the program instructions) for your programs? ◦ Follow a detailed analysis process for determining your project’s requirements (i.e., defining what the system is supposed to do) ◦ Develop a design that satisfies them (i.e., deciding how the system should do it). ◦ Carefully review the design (and have your design reviewed by other software professionals) before writing any code. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 58. ◦ Analyzing and designing your system from an object-oriented point of view is called an object-oriented analysis and design (OOAD) process. ◦ Languages like Java are object oriented. ◦ Object-oriented programming (OOP) allows you to implement an object-oriented design as a working system. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 59.  The UML (Unified Modeling Language) ◦ The Unified Modeling Language (UML) is the most widely used graphical scheme for modeling object-oriented systems. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 60.  Operating systems ◦ Software systems that make using computers more convenient. ◦ Provide services that allow each application to execute safely, efficiently and concurrently (i.e., in parallel) with other applications. ◦ The software that contains the core components of the operating system is called the kernel. ◦ Popular desktop operating systems include Linux, Windows 7 and Mac OS X. ◦ Popular mobile operating systems used in smartphones and tablets include Google’s Android, BlackBerry OS and Apple’s iOS (for its iPhone, iPad and iPod Touch devices). ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 61.  Windows—A Proprietary Operating System ◦ Mid-1980s: Microsoft developed the Windows operating system, consisting of a graphical user interface built on top of DOS—an enormously popular personal-computer operating system of the time that users interacted with by typing commands. ◦ Windows borrowed from many concepts (such as icons, menus and windows) popularized by early Apple Macintosh operating systems and originally developed by Xerox PARC. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 62. ◦ Windows 7, Microsoft’s latest operating system, features enhancements to the user interface, faster startup times, further refinement of security features, touch-screen and multi-touch support, and more. ◦ Windows is a proprietary operating system—it’s controlled by one company exclusively. ◦ Windows is by far the world’s most widely used operating system. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 63.  Linux—An Open-Source Operating System  Open-source software ◦ A software development style that departs from the proprietary development that dominated software’s early years. ◦ Individuals and companies contribute their efforts in developing, maintaining and evolving software in exchange for the right to use that software for their own purposes, typically at no charge. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 64. ◦ Eclipse Foundation (the Eclipse Integrated Development Environment helps Java programmers conveniently develop software) ◦ Mozilla Foundation (creators of the Firefox web browser) ◦ Apache Software Foundation (creators of the Apache web server) ◦ SourceForge (which provides the tools for managing open source projects—it has over 260,000 of them under development). ◦ Facebook, which was launched from a college dorm room and built with open-source software. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 65.  Linux ◦ The most popular open-source operating system. ◦ Developed by volunteers ◦ Popular in servers, personal computers and embedded systems. ◦ Source code is available to the public for examination and modification ◦ Free to download and install. ◦ Ability to completely customize the operating system to meet specific needs. ◦ 1991: Linus Torvalds began developing the Linux kernel. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 66. ◦ The name is derived from “Linus” and “UNIX”—an operating system developed by Bell Labs in 1969. ◦ Favorable response led to the creation of a community that has continued to develop and support Linux. ◦ Developers downloaded, tested, and modified the Linux code, submitting bug fixes and feedback to Torvalds, who reviewed them and applied the improvements to the code. ◦ The 1994 release of Linux included features found in a mature operating system, making Linux a viable alternative to UNIX. ◦ Extremely popular on servers and in embedded systems, such as Android-based smartphones. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 67.  Android ◦ Fastest growing mobile and smartphone operating system ◦ Based on the Linux kernel and Java. ◦ Open source and free. ◦ Developed by Android, Inc., which was acquired by Google in 2005. ◦ As of December 2010, more than 300,000 Android smartphones were being activated each day. ◦ Android smartphones are now outselling iPhones. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 68. ◦ Android operating system is used in numerous smartphones, e- reader devices, tablet computers, in-store touch-screen kiosks, cars, robots and multimedia players. ◦ Android smartphones include the functionality of a mobile phone, Internet client (for web browsing and Internet communication), MP3 player, gaming console, digital camera and more, wrapped into handheld devices with full-color multitouch screens—these allow you to control the device with gestures involving one touch or multiple simultaneous touches. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 69.  Android App-Development Chapters on the Companion Website ◦ The book’s companion website includes a three-chapter introduction to Android app development from the book, Android for Programmers: An App-Driven Approach. ◦ After you learn Java, you’ll find it straightforward to begin developing and running Android apps. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 70. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 71. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 72. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 73. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 74. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 75. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 76. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 77.  Microprocessors are having a profound impact in intelligent consumer-electronic devices.  1991 ◦ Recognizing this, Sun Microsystems funded an internal corporate research project led by James Gosling, which resulted in a C++-based object-oriented programming language Sun called Java. ◦ Key goal of Java is to be able to write programs that will run on a great variety of computer systems and computer-control devices. ◦ This is sometimes called “write once, run anywhere.” ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 78.  1993 ◦ The web exploded in popularity ◦ Sun saw the potential of using Java to add dynamic content to web pages.  Java garnered the attention of the business community because of the phenomenal interest in the web.  Java is used to develop large-scale enterprise applications, to enhance the functionality of web servers, to provide applications for consumer devices and for many other purposes. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 79.  Sun Microsystems was acquired by Oracle in 2009.  As of 2010 97% of enterprise desktops, three billion handsets, and 80 million television devices run Java.  Java is the most widely used software development language in the world. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 80.  Java Class Libraries ◦ Rich collections of existing classes and methods ◦ Also known as the Java APIs (Application Programming Interfaces). ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 81. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 82. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 83.  Java programs normally go through five phases ◦ edit ◦ compile ◦ load ◦ verify ◦ execute.  Download the JDK and its documentation from ◦ www.oracle.com/technetwork/java/javase/downloads /index.html.  Read the Before You Begin section of this book to ensure that you set up your computer properly to compile and execute Java programs.  Visit Oracle’s New to Java Center at:  www.oracle.com/technetwork/topics/newtojava/overview /index.html ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 84.  Phase 1 consists of editing a file with an I ◦ Type a Java program (source code) using the editor. ◦ Make any necessary corrections. ◦ Save the program. ◦ A file name ending with the .java extension indicates that the file contains Java source code. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 85. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 86.  Linux editors: vi and emacs.  Windows editors: ◦ Notepad ◦ EditPlus (www.editplus.com) ◦ TextPad (www.textpad.com) ◦ jEdit (www.jedit.org).  Integrated development environments (IDEs) ◦ Provide tools that support the software development process, including editors for writing and editing programs and debuggers for locating logic errors—errors that cause programs to execute incorrectly. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 87.  Popular IDEs ◦ Eclipse (www.eclipse.org) ◦ NetBeans (www.netbeans.org). ◦ jGRASP™ IDE (www.jgrasp.org) ◦ DrJava IDE (www.drjava.org/download.shtml) ◦ BlueJ IDE (www.bluej.org/) ◦ TextPad® Text Editor for Windows® (www.textpad.com/) ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 88.  Phase 2: Compiling a Java Program into Bytecodes ◦ Use the command javac (the Java compiler) to compile a program. For example, to compile a program called Welcome.java, you’d type  javac Welcome.java ◦ If the program compiles, the compiler produces a .class file called Welcome.class that contains the compiled version of the program. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 89. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 90.  Java compiler translates Java source code into bytecodes that represent the tasks to execute.  Bytecodes are executed by the Java Virtual Machine (JVM)—a part of the JDK and the foundation of the Java platform.  Virtual machine (VM)—a software application that simulates a computer ◦ Hides the underlying operating system and hardware from the programs that interact with it.  If the same VM is implemented on many computer platforms, applications that it executes can be used on all those platforms. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 91.  Bytecodes are platform independent ◦ They do not depend on a particular hardware platform.  Bytecodes are portable ◦ The same bytecodes can execute on any platform containing a JVM that understands the version of Java in which the bytecodes were compiled.  The JVM is invoked by the java command. For example, to execute a Java application called Welcome, you’d type the command  java Welcome ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 92.  Phase 3: Loading a Program into Memory ◦ The JVM places the program in memory to execute it—this is known as loading. ◦ Class loader takes the .class files containing the program’s bytecodes and transfers them to primary memory. ◦ Also loads any of the .class files provided by Java that your program uses.  The .class files can be loaded from a disk on your system or over a network. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 93. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 94.  Phase 4: Bytecode Verification ◦ As the classes are loaded, the bytecode verifier examines their bytecodes ◦ Ensures that they’re valid and do not violate Java’s security restrictions.  Java enforces strong security to make sure that Java programs arriving over the network do not damage your files or your system (as computer viruses and worms might). ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 95. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 96.  Phase 5: Execution ◦ The JVM executes the program’s bytecodes. ◦ JVMs typically execute bytecodes using a combination of interpretation and so-called just-in-time (JIT) compilation. ◦ Analyzes the bytecodes as they’re interpreted ◦ A just-in-time (JIT) compiler—known as the Java HotSpot compiler—translates the bytecodes into the underlying computer’s machine language. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 97. ◦ When the JVM encounters these compiled parts again, the faster machine-language code executes. ◦ Java programs go through two compilation phases ◦ One in which source code is translated into bytecodes (for portability across JVMs on different computer platforms) and ◦ A second in which, during execution, the bytecodes are translated into machine language for the actual computer on which the program executes.  ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 98. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 99. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 100.  Checking your setup. Read the Before You Begin section of the book to confirm that you’ve set up Java properly on your computer and that you’ve copied the book’s examples to your hard drive. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 101. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 102. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 103. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 104. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 105. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 106. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 107. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 108. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 109.  The web exploded in the mid-to-late 1990s, but the “dot com” economic bust brought hard times in the early 2000s.  Resurgence that began in 2004 or so has been named Web 2.0.  Google is widely regarded as the signature company of Web 2.0.  Some other companies with “Web 2.0 characteristics” are YouTube (video sharing), FaceBook (social networking), Twitter (microblogging), Groupon (social commerce), Foursquare (mobile check-in), Salesforce (business software offered as online services), Craigslist (free classified listings), Flickr (photo sharing), Second Life (a virtual world), Skype (Internet telephony) and Wikipedia (a free online encyclopedia). ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 110.  Google ◦ In 1996, Stanford computer science Ph.D. candidates Larry Page and Sergey Brin began collaborating on a new search engine. ◦ In 1997, they changed the name to Google—a play on the mathematical term googol ◦ Google’s ability to return extremely accurate search results quickly helped it become the most widely used search engine and one of the most popular websites in the world. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 111.  Web Services and Mashups ◦ Mashup is an applications-development methodology in which you can rapidly develop powerful and intriguing applications by combining (often free) complementary web services and other forms of information feeds.  ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 112. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 113. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 114.  Ajax ◦ One of the premier Web 2.0 software technologies. ◦ Helps Internet-based applications perform like desktop applications ◦ A difficult task, given that such applications suffer transmission delays as data is shuttled back and forth between your computer and server computers on the Internet. ◦ Applications like Google Maps have used Ajax to achieve excellent performance and approach the look-and-feel of desktop applications. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 115.  Social Applications ◦ Over the last several years, there’s been a tremendous increase in the number of social applications on the web. ◦ These sites were able to become phenomenally successful in a relatively short period of time.  ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 116. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 117. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 118. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 119. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 120. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 121.  ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 122. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 123. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 124. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 125. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 126. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 127. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 128. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 129. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 130. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.
  • 131. ©1992-2012 by Pearson Education, Inc. All Rights Reserved.