Contents
Introduction
Part I Introducing Java
1 Objects and Classes
The COBOL Subroutine
Calling a Subroutine
MYSUB COBOL
CALLER COBOL
CALLER COBOL: CONTROL
Terms to Review: Subroutines
Objects and Java
ErrorMsg Class
Caller Class
Terms to Review: Objects
2 Introducing the Java Development Environment
Runtime Interpretation and Java Byte Codes
Getting Started with Java’s SDK
Applets with SDK
Classes and Filenames
CLASSPATH
CODEBASE
Packages
Inside a Package
Name Collisions
Packages and Filenames
Compressed Packages
Applications vs. Applets
Reviewing the Samples
3 Messages and Methods
MYSUB COBOL
CALLER COBOL
Messages in Java
ErrorMsg Class
Caller Class
Multiple Messages
Class ErrorMsg
Method Overloading
Caller Class
Method Overloading in COBOL
MYSUB COBOL
CALLER COBOL
Terms to Review
Exercises: Classes, Objects, and Methods
Reviewing the Samples
HelloWorld: The Application
HelloWorld: The Applet
ErrorMsg: The Class
4 Class Members
MYSUB COBOL
MYSUB COBOL: ACTION-SWITCH
Java Variables
ErrorMsg Class
Classes, Objects, and Members Review
Objects and COBOL
Using Objects in Java
Java Data Members
ErrorMsg Class
Caller Class
Local Variables
Primitive Data Types
Arrays
Arrays as Parameters
Method Members
ErrorMsg Class: Static Variable
ErrorMsg Class: Static Initializer
Constructors
Exercises: Class Members
Reviewing the Samples
5 Inheritance, Interfaces, and Polymorphism
Inheritance and Object-Oriented Design
Inheritance and Objects
Inheriting Methods
Caller Class
Redefining a Method
ErrorMsg Class
Caller Class
Extending a Method
ErrorMsg Class
Caller Class
Why Inheritance?
Inheritance, Objects, and COBOL
NEWSUB COBOL
NEWSUB COBOL: MYSUB
More COBOL Object-Oriented Design Patterns
CALLER COBOL
MYSUB COBOL
Inheritance and Java
ErrorMsg Class
PopupErrorMsg Class
PrintfileErrorMsg Class
TextMessage Class
ErrorMsg Class
PopupErrorMsg Class
PrintfileErrorMsg Class
Consumer Class
TextMessage Class
ErrorMsg Class
ErrorMsg Class: Override
PopupErrorMsg Class
PrintfileErrorMsg Class
Consumer Class
PrintfileErrorMsg Class
Sharing Variables and Methods
Hiding Variables and Methods
The this Variable
Java Interfaces
Writeline Interface
PrintfileErrorMsg Class
Caller Class
Using Interfaces
Hiding Methods and Members
Polymorphism
Exercises
Reviewing the Samples
Part II Java’s Syntax
6 Java Syntax
COBOL vs. Java Syntax
Java Statements
Java Comments
Java Operators
Binary Arithmetic Operations
Understanding Reference Variables with COBOL
Exercises: Java’s Syntax
Reviewing the Exercises
7 Flow Control
Code Block
The if Statement
The while Statement
The do...while Statement
The for Statement
The switch Statement
The break, continue Statements
Exercises: Flow Control
Reviewing the Exercises
8 Strings, StringBuffers, StringBuilders, Numbers, and BigNumbers
Strings
Comparing Strings
Working with Strings
Numeric Wrapper Classes
StringBuffers
BigNumbers
Exercises: Strings, StringBuffers, Numbers, and BigNumbers
Reviewing the Exercises
9 Exceptions, Threads, and Garbage Collectors
Exception Class Hierarchy
Creating Exceptions
Using Exceptions
Exception-Processing Suggestions
Exception-Processing Summary
Threads
Inheriting from Thread
Implementing Runnable
Synchronization
Benefits and Cautions
Garbage Collection
Exercises: Java’s Exceptions and Threads
Reviewing the Exercises
10 I/O in Java
Streams vs. Record-Based I/O
The File Class
InputStream and OutputStream
Serialization
Readers and Writers
RandomAccessFile
Exercises
Reviewing the Exercises
11 Java Collections
Collections Background
Ordered Collections: Vectors and ArrayLists
Keyed Collections: Hashtable and HashMap
Other Collections
Iterators
Ordering and Comparison Functions
Exercises: Java Collections
Reviewing the Exercises
12 Other Java Topics
Graphical User Interface Development
Properties Files
Java Utilities
Jar Utility
Javadoc Utility
Exercises
Reviewing the Exercises
Part III Introducing Enterprise Java
13 Java Database Connectivity
How JDBC Works
Connecting to the Database
Querying a Table
Inserting, Updating, and Deleting
Configuring the JDBC-ODBC Bridge
Exercises
Reviewing the Exercises
14 Servlets and Java Server Pages
Browsers and Web Servers
The Servlet as Transaction Processor
Servlet Protocol
Java Server Pages
Getting Started with Servlets and JSPs
Exercises
Reviewing the Exercises
15 Introduction to Enterprise JavaBeans
Distributed Computing
The Different Kinds of EJBs
Container Services
The Interfaces and the Implementation Class
Accessing the Bean from the Client
Exercises
Reviewing the Exercises
16 Introduction to XML
The Basics
XML vs. HTML
Document Type Definitions (DTDs)
DTD Components
Elements
Attributes
Entities
XML Declaration
A Complete XML Document
XML Schemas
Authoring XML Documents
XML and Java
XML and HTML
Where to Use XML
Electronic Data Interchange (EDI)
Online XML or Web Services
XML and OAG
Other Opportunities
Exercises
Reviewing the Exercises
17 Introducing Eclipse
Installing Eclipse
Start Using Eclipse
Make a New Eclipse Project
Run with Eclipse
Debug with Eclipse
Refactoring with Eclipse
Part IV Appendixes
Appendix A: About the CD-ROM
Exercises
Java SDK
LegacyJ
Eclipse
Tomcat
SoftwareMining
Case Studies
Appendix B: Java Information Available Elsewhere
Java Resources
Java Magazines
Java Tools
COBOL Information
Appendix C: Buzzwords
Active Server Pages (ASP)
AWT
Client/Server
Common Object Request Broker Architecture (CORBA)
Components
Component Object Model (COM)
Distributed Component Object Model (DCOM)
Enterprise JavaBeans (EJBs)
File Transfer Protocol (FTP)
Firewall
Hypertext Transfer Protocol (HTTP)
Integrated Development Environment (IDE)
Interface Definition Language (IDL)
Internet Inter-ORB Protocol (IIOP)
JavaBeans
Java Native Interface (JNI)
JavaScript
Java Server Pages (JSP)
JDBC
Microsoft Foundation Classes (MFC)
Open Database Connectivity (ODBC)
Remote Method Invocation (RMI)
Remote Procedure Call (RPC)
Secure Sockets Layer (SSL)
Swing
TCP/IP
Unified Modeling Language (UML)
Uniform Resource Locator (URL)
VBScript
Web Services
Appendix D: Sun Microsystems, Inc.
Binary Code License Agreement
Index