ISBN-10:
1588801403
ISBN-13:
9781588801401
Pub. Date:
08/31/2001
Publisher:
Coriolis Value
Java 2 Exam Prep, Second Edition / Edition 2

Java 2 Exam Prep, Second Edition / Edition 2

Hardcover

Current price is , Original price is $59.99. You
Select a Purchase Option (2ND BK&CDR)
  • purchase options
    $44.39 $59.99 Save 26% Current price is $44.39, Original price is $59.99. You Save 26%.
    Currently Unavailable for Shipping
    Please check below for Buy Online, Pick up in Store.
  • purchase options

Product Details

ISBN-13: 9781588801401
Publisher: Coriolis Value
Publication date: 08/31/2001
Series: Exam Prep Series
Edition description: 2ND BK&CDR
Pages: 640
Product dimensions: 7.88(w) x 9.62(h) x 1.91(d)

About the Author

Bill Brogden (Austin, Texas) is a full time programmer and author with over 20 years of experience. Bill is an expert in several programming languages and currently focuses on the Java language, of which he has written five books. He has also developed the script-driven Java-based architecture for LANWright's online course delivery engines that is used to provide practice tests on a wide range of subjects.

Read an Excerpt

Chapter One: Introduction to Java

After completing this chapter, you will be able to:
  • Understand some of the design philosophy behind Java
  • Understand the parts of the Java Software Development Kit (SDK)
  • Run the demo programs included with the SDK
Java started as "Oak," a language devised at Sun Microsystems by James Gosling; he invented Oak to be used as code embedded in consumer electronics control-lers. Gosling was frustrated by the difficulties of creating stable and secure control programs in C, so he decided to make a fresh start. When the embedded controller business went off in other directions, Oak was without a job—that is, until the Internet and the World Wide Web came along. Suddenly, Java had a new career opportunity.

Java Design Principles

One joke making the rounds when Java was first introduced described Java as "fully buzzword-compliant." This statement does have a certain amount of truth, because Java incorporates much of the modern thinking about computer languages. One of the first statements from the designers described Java as a simple, object-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, high-performance, multithreaded, and dynamic language.

The following list analyzes whether this description of Java has held up in the years since then:

  • Simple—Java's syntax and program organization is certainly much simpler than competing languages, such as C and C++. This simplicity is the benefit of starting with a clean slate. The decision to use many aspects of C syntax has made it easy for programmers to move from C to Java.

  • Object oriented—All Java programs consist entirely of interacting Java objects. The decision to make Java completely object oriented has certainly been vindicated by the ease with which various extensions have been created.

  • Distributed—Java was "network aware" from the beginning and seems to have become the preferred language for networked applications in which the complete application is composed of parts distributed across the network.

  • Portable, interpreted, architecture-neutral—Java programs are compiled to bytecodes that have no dependencies on a particular machine architecture. To run on a particular system, all you need is a Java interpreter. Java now runs on a large variety of systems, from mainframes to intelligent credit cards.

  • Robust—The Java designers made numerous design decisions to avoid the weaknesses inherent in other languages. Among these decisions was one to include strong typing, automatic memory management, and built-in array bounds checking.

  • Secure—The Java architecture provides multiple layers of security checking. These security checks range from low-level verification that bytecodes are legal, to high-level control of access to files and other system resources.

  • High-performance—Although some aspects of Java are very efficient, its raw speed still hasn't reached the level of C++, except in some limited cases.

  • Multithreaded—Java's design has made it easy to create multithreaded programs, which is one reason for Java's popularity in networked applications.

  • Dynamic—Running programs in Java can be dynamically modified, and developers have benefited greatly from this increased flexibility.

History of Java

Someday, the saga of Java's introduction and its impact on the computer industry will make an interesting story. Most introductions of new computer languages seem to creep along as various books and articles are written and people start experimenting.

Why Java has had such a huge impact so quickly is worth analyzing. The following factors seem to be among the most important:

  • Development subsidy by a large corporation—As a major hardware producer, Sun Microsystems could afford to fund the development program, publicity, and free distribution of Java.

  • The Internet—The first major Java program was the HotJava Web browser. The development of this browser demonstrates the extent to which Java's design is suitable for Internet-related applications. Programmers were looking for an easy route to explore programming for the Internet, and Java was right there for free download.

  • Worries about Wintel—The lock that Microsoft and Intel had obtained on the desktop computer had a lot of people worried. Java seemed to offer an escape from the Wintel world.
Table 1.1 presents a condensed timeline of recent Java history. On Java's route from its first public release in the spring of 1995 to its present form, Java 2, two major changes (as well as numerous minor changes) have occurred. Most of the core language has been stable since Java 1.1 was introduced. The release of the SDK 1.3 version has not changed the content of the programmer certification exam.

Table 1.1 A short history of Java....

Java Tools

Sun provides the basic tools for Java in the Software Development Kit (SDK), which is platform dependent and in a separate documentation package that is platform independent. All of the platform-dependent code is used to create a Java Virtual Machine (JVM) for a particular hardware and operating system configuration.

The Java Virtual Machine

You might think of the JVM as creating a computer within a computer—a virtual computer. The instructions in Java programs are compiled to bytecodes, which are the instructions for this virtual computer. Naturally, bytecodes are called such because they occupy a single eight-bit byte. In addition to interpreting bytecodes, the JVM must supply interfaces to the various subsystems that the operating system manages for the display, mouse, keyboard, file system, and I/O ports.

Development Tools

As the scope of the various Java libraries and toolkits continues to expand, Sun has rationalized the grouping of these products into three areas...

Table of Contents

Exam Insightsxxv
Self-Assessmentxxxv
Chapter 1Introduction to Java1
Java Design Principles2
History of Java3
Java Tools4
Sun's Java Certification Exam6
Get a Java Job7
Chapter 2Java Language Fundamentals13
The Structure of Java Programs14
Java Reserved Words17
Java Variables and Data Types18
Class Basics25
Interface Basics28
Sun's Software Development Kit28
Conventions for Applications30
Conventions for Applets33
Javadoc Format Documentation36
Chapter Summary37
Chapter 3Java Operators with Primitives and Objects47
Numeric Operators48
Logical and Bitwise Operators55
Logical Operators58
Logical Operators with Objects60
String Operators: A Special Case64
Expression Evaluation66
Casting and Converting of References67
Array Declaration, Initialization, and Conversion68
Chapter Summary70
Chapter 4Creating Java Classes85
Creating Java Classes86
Declaring a Java Class86
Constructors98
Static Members and Variables101
The this Keyword106
Automatic Variables109
Method Signatures113
Inner Classes113
Chapter Summary118
Chapter 5Flow Control and Exceptions135
Loops with for, while, and do136
Branching with if--else and switch140
Summary of Basic Flow Control142
Exceptions, Errors, and Flow Control143
Exceptions, try, catch, and finally146
Designing Programs with Exceptions147
Chapter Summary148
Chapter 6Program Architecture with Java Classes and Objects167
Extending Classes and Implementing Interfaces168
Overriding Methods170
Overloading Methods173
Abstract Classes in Program Design174
More about Interfaces175
The Class Class177
The final Problem178
Class Design and Encapsulation178
Design Patterns and Java179
Memory Management in Java182
Chapter Summary185
Chapter 7Java Threads201
Multitasking vs. Multithreading202
The Thread Class203
Thread Groups210
Synchronizing Objects and Threads211
Using wait and notify215
Hazards of Thread Programming217
Exceptions Associated with Threads218
Chapter Summary218
Chapter 8Standard Java Library235
The Core Classes236
The Extended Math Classes247
The Utility Classes248
The Original Collections251
The Advanced Collections Classes257
Chapter Summary265
Chapter 9Java AWT and JFC Components279
What Is on the Exam?280
An Overview of Java Graphical Interfaces280
The Java AWT Packages282
The Component Class283
The Container Class287
Menu-Related Classes294
Graphics-Related Classes in the AWT297
Event-Related Classes in the AWT303
User Interfaces with Swing Classes304
A Summary of User Controls with AWT and Swing311
Chapter Summary312
Chapter 10Building GUI Applications with Layout Managers329
The Layout Manager Concept330
Specialized Containers341
Chapter Summary344
Chapter 11Java Event Handling361
A Brief History of Java Event Handling362
The Event Hierarchy364
Generating Events370
Event Listeners371
Coordinating Events with Actions375
Chapter Summary376
Chapter 12Java Graphics399
Introduction to Graphics400
The Graphics Class400
Drawing Text406
The Graphics2D Class410
Printing411
Working with Images414
Chapter Summary418
Chapter 13Java I/O431
Dealing with IOException432
How Java Treats Files432
Stream Methods438
Filtering Input Streams443
Readers and Writers445
Object Serialization448
JAR and Zip Files450
Networks, Sockets, TCP/IP, and Datagrams451
Talking to Serial and Parallel Ports454
Chapter Summary455
Chapter 14Advanced Java Topics467
The Big Picture468
Java 2 Micro Edition469
Java 2 Standard Edition472
Java 2 Enterprise Edition474
Chapter 15Sample Test485
Chapter 16Answer Key523
Appendix AAnswers to Review Questions535
Appendix BObjectives for Exam 310-025555
Appendix CStudy Resources557
Appendix DJava Programming and Debugging Hints561
Glossary567
Index591

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews