* (asterisk) wild card, 31
// (two forward slashes), 153
[ ] (braces), 337
_ (underscore character), 150
{ } (curly braces), 167
+ (concatenate) operator, 192, 193
++ (increment) operator, Java, 155
++x (prefix) operator, Java, 155
<applet> tag, 25
. (period), 150
Abstract Window Toolkit (AWT), 20, 279–280
AbstractSequentialList, 272
acquire( ) method, threads, 234
acquireUninterruptibly( ) method, threads, 234
ACTION-SWITCH, COBOL
adding multiple message types with, 38–39
implementing inheritance, 113–118
method members vs., 87
private variables similar to, 14
returning value from private variables, 68
ActiveX specification, 322
add( ) method, ArrayLists, 267
addElement( ) method, Vectors, 267
AMOUNT element, OAG standard, 345
applet viewer (appletviewer.exe)
executing Java’s SDK, 21
testing applets with, 35
<applet> tag, 25
applications vs., 34
CODEBASE references, 28
creating with Java’s SDK, 24–26
defined, 19
portability problems of, 19–20
summary of, 35
using AWT for GUI interaction, 279–280
applications
applets vs., 34
using AWT for GUI interaction, 279–280
arithmetic operations, Java, 154–159
floating-point operations, 154–155
increment and decrement operators, 155
list of, 156
object reference variables, 157–159
postfix and prefix operators, 155
shortcut coding style, 155
arraycopy( ) function, 85
arraycopy( ) method, 85
ArrayIndexOutOfBoundsException exception, 84
ArrayList collection class
Vectors vs., 264
arrays
as parameters, 87
ASCII character set, 254
ASSIGN statement, 244
assignment function, Java vs. COBOL, 149
asterisk (*) wild card, import statement, 31
authoring, XML documents, 339
auto-commit, Connection class, 297
AUTOEXEC.BAT file, 22
AWT (Abstract Window Toolkit), 20, 279–280
base classes. see also superclasses (parent classes)
bottom-up design, 102
hiding variables and methods, 126–127
Java inheritance concepts, 121–126
multiple inheritance and, 121
overview of, 102
using inheritance as design pattern, 109
Basic Multilingual Plane (BMP), 190
begin tag...end tag construct, XML, 332
BigDecimals, 202–204, 214–215, 217
BigIntegers, 202–204, 214–215, 217
BigNumbers, 202–208, 214–216, 217
binary arithmetic operators, Java, 154–159
binarySearch( ) function, collections, 274
bitwise operations, Java, 156
black box, COBOL, 112
BMP (Basic Multilingual Plane), 190
bottom-up design, inheritance, 102
braces ({ }), 167
brackets ([ ]), 337
break statement
defined, 181
exiting switch loop with, 177
flow control exercises, 184–186
breakpoint, Eclipse debugger, 362–363
browsers
supporting applets, 35
C comments, Java syntax, 152–153
C++ comments, Java syntax, 152–153
cab files, 33
CALL SUBROUTINE USING, COBOL, 4–9
callbacks, SAX parser, 340
CALLER COBOL
implementing inheritance, 114–115
calling program
accessing public data members, 16
causing runtime errors, 47
COBOL subroutines and, 4
containing its objects, 14
creating new object prior to using it, 71
error processing capabilities, 196, 219–220, 225
inheritance in COBOL, 113, 119
method overloading in COBOL, 44–45
and reference variables, 71, 73
cardinality rules, DTD elements, 334–335
case sensitivity
identifiers, 151
Java compilers, 150
case statements
EVALUATE verb vs., 187
flow control exercise, 184
catalog content management, XML, 352
CICS, 314
class libraries, building GUIs with, 20, 279–281, 286–289
classes, objects and members, 71–72
class methods, 87
class variables
defined, 77
overview of, 70
classes
from COBOL perspective, 9
grouping into packages. see packages
inheritance hierarchy, 102–103
Java interfaces vs., 129
CLASSPATH directory
exercises, 55
client
accessing EJB from, 327
using online XML, 343
CLOSE file, 244
COBOL
collections vs. files in, 264–265
error management, 220
Java flow control operators vs., 181
Java Strings vs., 189–190, 194–196
statements, 150
understanding reference variables, 154–159
COBOL subroutines. see also MYSUB COBOL
objects vs., 5
overview of, 4
CODEBASE references, 28
AbstractSequentialList, 272
defining, 263
HashSet, 271
keyed, Hashtable and HashMap, 270–271
LinkedList, 272
managing arguments and returning values for methods, 84
ordered, Vector and ArrayList, 266–270
ordering and comparison functions, 273–275
TreeSet, 272
commands, executable, 21
COMMAREA, CICS, 314
comments
flow control exercises, 182
Comparator interface, collections, 274–275
compareTo( ) method, 216, 274–275
comparison functions, collections, 273–275
compressed packages, 33
concatenate operator (+), 192, 193
ConcurrentHashMap collection class, 270
constructors
BigDecimal and BigInteger, 203–204
Hashtable and HashMap, 270–271
from Java perspective, 14
Vectors and ArrayLists, 267
consumer (calling) class
method overloading, 43
redefining methods, 106
sending messages to objects, 41
treating super-type objects, 109
using derived classes, 122
continue statement
defined, 181
flow control exercise, 184
copy( ) function, collections, 273
COPY statement, COBOL, 31
CounterServlet.java file, 317–320
currentThread( ) method, 238–239, 241
data encapsulation, COBOL, 65
data repositories, XML, 351
databases. see JDBC (Java Database Connectivity)
DATETIME element, OAG standard, 345–347
debugging, with Eclipse, 362–363
DecimalFormat class, 197–198, 261
clarifying variable for this operator, 127–128
defined, 102
extending inherited methods, 106–108
hiding methods and members, 131
hiding variables and methods, 126–127
design patterns
COBOL object-oriented, 112–119
Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, Helm, Johnson, and Vlissides), 108–109
directories
creating for applets, 24
creating for Java files, 22
Java packages related to, 32–33
distributed computing, EJBs, 322–323
DNS (domain name system), 32, 308
Document Object Model (DOM) interface, 340
document type definitions. see DTDs (document type definitions), XML
doGet( ) method, HttpServlet, 312, 318
DOM (Document Object Model) interface, 340
domain name system (DNS), 32, 308
doskey command, 21
Double numeric class wrapper, 197–198
doubleValue( ) method, 197–198
do...while statement, 174–175, 181
drawstring( ) method, Graphics class
adding to applet, 26, 55–56, 59
overview of, 36
DriverManager, 296
drivers, JDBC
connecting to database, 296–298
defined, 294
DTDs (document type definitions), XML
elements, 334
OAG specifications for, 344–351
installing, 356
overview of, 355
runtime, 362
EDI (Electronic Data Interchange), XML and, 342–343
EJBs (Enterprise JavaBeans), 321–328
accessing from client, 327
distributed computing and, 322–323
interfaces and implementation class, 325–327
Electronic Data Interchange (EDI), XML and, 342–343
elements
adding to Hashtable and HashMap, 271
adding to Vectors or ArrayLists, 267–268
XML nested, 332
encapsulation, 76
Enterprise Java
Eclipse. see Eclipse
Enterprise JavaBeans. see EJBs (Enterprise JavaBeans)
JDBC. see JDBC (Java Database Connectivity)
XML. see XML (Extensible Markup Language)
enterprise resource planning (ERP), 343
EntityBeans, EJBs, 323–324, 326–327
equals( ) method, 191–192, 216
ERP (enterprise resource planning), 343
Error class, 221
ErrorMsg class
exercises, class members, 91–94, 96–97, 99
exercises, polymorphism, 142–143, 145
exercises, variables, 133–138, 140, 144
Hashtable and HashMap, 271
hiding variables and methods, 127
refactoring in Eclipse, 366–367
errors
exception handling. see exceptions
refactoring with Eclipse, 363–367
EVALUATE verb, COBOL, 177, 181, 187
exception processing, 196
Exception class hierarchy, 221
processing suggestions, 228–229
EXCHANGE-AMOUNT, COBOL, 204–205
executable code, 18
executeUpdate( ) method, 301
execution process, Java, 18–19
exists( ) method, File class, 248
extends keyword, Java inheritance, 119–121
Extensible Business Reporting Language (XBRL), 352
Extensible Markup Language. see XML
external entities, DTD, 336
factory class, 297
FILE SECTION, DATA DIVISION, 244
FileInputStream class, 250
filenames
FileReader class, 255
File.separator variable, 246
fill( ) function, collections, 273
Final keyword, 78
finalize( ) methods, garbage collection, 237
finally statement, 224–226, 229
floating-point operations, Java, 154–155
code block, 168
list of operators, 181
for loop, collections, 273
for statement
defined, 181
flow control exercises, 183–185
forName( ) method, 296
fully qualified names, 30
get( ) methods, File class, 247–248
getConnection( ) method, database, 296, 302
getCounter( ) method, 100
getErrorMsg( ) method
synchronization, 234
using overloaded version of, 56–58, 95
getFilePointer( ) method, RandomAccessFile, 257
getMessage( ) method, Exception class, 222
graphical user interfaces. see GUIs (Graphical user interfaces)
Graphics class, 36
GUIs (graphical user interfaces)
building with class libraries, 20
handle, reference pointer, 71
HashMap collection class
Hashtable vs., 264
HashSet, 271
Hashtable collection class, 264, 270–271
HelloWorld applet
HelloWorld application
HelloWorld.html, 25
HelloWorld.java (example exercises)
applets, 24
numeric wrapper classes, 210–213
string methods, 210
hiding methods
and members, 131
home page, Eclipse, 357
hostname, 308
HTML (Hypertext Markup Language)
executing applets, 25
HTTP (Hypertext Transfer Protocol)
compressed packages and, 33
Hypertext Markup Language. see HTML
IDE (integrated development environment), 20, 355
if statement
defined, 181
flow control exercises, 181–182
immutable strings, 192
implementation class, EJB, 325–327
importing, Java files to Eclipse project, 358–360
IMS, 314
increment operator (++), 155
indexed sequential (ISAM) file type, 270
information transfer systems, XML, 352
clarifying variable for this operator, 127–128
COBOL object-oriented design patterns, 112–119
Exception class and, 221
extending class methods, 123–124
hiding methods and members, 131
hiding variables and methods, 126–127
object-oriented design and, 101–102
objects and, 103
polymorphism and, 132
sharing variables and methods, 126
using protected keyword, 122–123
initialization
inputfile property, properties file, 282
INPUT-OUTPUT SECTION, ENVIRONMENT DIVISION, 244
InputStream class, 249–251, 259–260
installing, Eclipse, 356
integer operations, Java, 154–155, 269
integrated development environment (IDE), 20, 355
intelligent agents, XML, 352
interfaces
from COBOL perspective, 9
Java Collection framework, 265–266
internal entities, DTD, 336
InputStream and OutputStream classes, 249–251
overview of, 243
RandomAccessFile class, 256–258
Reader and Writer classes, 254–256
streams vs. record-based I/O, 244–246
IOException class creating Exception objects with, 221
defined, 221
handling exceptions, 228
ISAM (indexed sequential) file type, 270
isDirectory( ) method, File class, 248
isFile( ) method, File class, 248
isolation level, EJBs, 324
jar files
compressed package technology, 33
containing servlet classes, 319
Java. see also Enterprise Java
applets. see applets
BigNumbers. see BigNumbers
collections. see collections
exceptions. see exceptions
flow control. see flow control, Java
I/O. see I/O in Java
numbers. see numbers
StringBuffers. see StringBuffers
strings. see strings
threads. see threads
Java API For XML Processing (JAXP), 339–341
Java byte codes, 18
Java compiler (javac.exe)
compiling Java source, 23
executing for SDK, 21
writing programs, 20
Java Database Connectivity. see JDBC (Java Database Connectivity)
Java Development Environment, 17–36
applications vs. applets, 34
CODEBASE references, 28
compressed packages, 33
getting started with SDK, 21–24
runtime interpretation and Java byte codes, 17–21
writing applet with SDK, 24–26
java. exe (Java runtime), 21, 23
Java Foundation Classes (JFC), 20, 280–281
Java Naming and Directory Interface (JNDI), 327
Java run unit, 16
Java runtime (java. exe), 21, 23
Java Server Pages. see JSPs
Java Studio, 21
binary arithmetic operators, 154–159
flow control. see flow control, Java
reference variables, understanding with COBOL, 159–160
Java virtual machines (JVMs), 18–20
JAVA_HOME environment variable, 316
JavaBeans, 322
Javadoc
JAXP (Java API For XML Processing), 339–341
JDBC (Java Database Connectivity), 293–304
configuring JDBC-ODBC bridge, 301–302
inserting, updating and deleting, 300–301
overview of, 293
JDBC-ODBC bridge, 294–295, 301–304
JEE SDK, download and tutorial, 327–328
JFC (Java Foundation Classes), 20, 280–281
JNDI (Java Naming and Directory Interface), 327
JSPs (Java Server Pages), 314–320
design principles for, 307
getting started with servlets and, 316–317
JVM (Java virtual machine), 18–20
LANGUAGECODE static variable, 133, 135–136, 144
length numbers, arrays, 84
LINKAGE SECTION, COBOL
describing subroutine parameters in, 4
implementing inheritance, 109–112, 116–119
LinkedList, 272
List interface, collections
AbstractSequentialList implementation, 272
defined, 265
LinkedList implementation, 272
local variables
review, 100
lookup() method, JDB, 327
Map interface, collections, 265, 270
markup tags, Javadoc comments, 285–286
MathContext parameter, Big Decimals, 203
max( ) function, collections, 274
member data items, 47
members
hiding methods and, 131
memory
collections stored in, 265
shrinking Vectors or ArrayList to conserve, 269
message passing, 37
MessageBeans, EJBs, 324, 326–327
defined, 132
exercises in classes, objects and methods, 49–57
method overloading in COBOL, 44–48
terms, 48
method overloading
method signatures, 48
methods
ArrayList, 270
Connection class, 298
hiding members and, 131
InputStream class, 250
Java, 48
numeric wrapper classes, 196–199
private, 70
public, 70
static, 70
Vector, 270
MIME (Multipurpose Internet Media Extension) type, 309
min( ) function, collections, 274
MS-DOS window, 21
MsgThreadRunnable.java file, 238–239
multiple inheritance, 121, 128–129
Multipurpose Internet Media Extension (MIME) type, 309
myErrorMsg class, 12–13, 58–60
implementing inheritance, 116–119
MYSUB-CONTROL
all instances as objects in, 8–9
class data members in, 10
ErrorMsg class and, 11
object-oriented language and, 7
naming conventions
classes inside packages, 29–31
internal and external classes, 35
New Java Project dialog, Eclipse, 358–359
next() method, ResultSet, 299
NoDatabaseAvailableException, 223, 228
numeric wrapper classes, 196–199
placing into Vector arrays, 269
rounding options in Java and COBOL, 206
numeric wrapper classes, 196–199, 210–213, 217
OAG (Open Application Group), XML, 344–351
object instance variables, 71, 72–76
object reference variables, Java, 157–160
object wrappers, 269
ObjectInputStream class, 253–254
object-oriented language. see OO (object-oriented language)
ObjectOutputStream class, 253–254
functionality of, 3
inheritance and, 103
message passing, 37
ODBC (Open Database Connectivity)
JDBC-ODBC bridge, 294–295, 301–302
online references
authoring XML documents, 339
Java Software Development Kit, 20, 327
opening zip files, 356
predefined Exception objects, 221
Sun’s coding conventions, 151, 167
Tomcat, 316
URI type file specification, 247
classes, objects and members, 71–72
from Java perspective, 3, 13–14
message passing, 37
method overloading, 48
method signatures, 48
methods, 48
Open Application Group (OAG), XML, 344–351
Open Database Connectivity. see ODBC (Open Database Connectivity)
OPEN file, 244
operator overloading, 193, 203
operators, Java
flow control, 181
options switches, 113
Order document type, 337
ordering functions, collections, 273–275
outputfile property, properties file, 282
OutputStream class, 249–251, 258–260
Package Explorer, Eclipse
creating Java project, 359, 361
debugging with, 362
compressed, 33
variables, 68
paint( ) function, 35
parameter entities, DTD, 336–337
parameters
arrays as, 87
passed, 47
parent classes. see superclasses (parent classes)
parentheses
controlling evaluation of expressions, 170
parse( ) method, DecimalFormat class, 197–198
passed parameters, Java, 47
pathname, Web servers, 309
PERFORM UNTIL, COBOL, 181, 187
performance, and Vectors, 267–268
period (.), 150
PopupErrorMsg sample, 120, 122, 124–125, 128
precedence conventions, operators, 153–154
prefix operator (++x), 155
prepared statements, 300
prepareStatement( ) method, Connection, 300
primitive data types
autoboxing and unboxing, 199
Java Strings syntax vs., 190
PrintFileErrorMsg sample
hiding variables and methods, 127, 138–139
inheritance, 119–120, 122, 124–126
using Java interfaces, 129–130, 139–141
printIn( ) method, 216
printIn statement
exercises, class members, 92–93
review, 100
PrintStream, 245
private elements or properties, COBOL, 10
private elements or properties, Java, 14
private variables
properties, OO terminology, 7
properties files, Java, 281–282
protected keyword, Java, 122–123
protected variables, Java, 68, 77
public elements or properties, COBOL, 10
public elements or properties, Java, 14
public variables
COBOL, 68
put() method, Hashtable and HashMap, 271
Queue interface, collections, 266
RandomAccessFile class, 256–258
READ file, 244
READ NEXT statement, COBOL, 299
reading data
InputStream methods, 250
readLine( ) method, BufferedReader, 255
refactoring, with Eclipse, 363–367
reference variables
arrays as, 85
assignment and equality in, 157–159
defined, 71
understanding with COBOL, 159–160
release( ) method, threads, 234
Reload function, applet menu, 26
remote interface, coding EJB, 325
Remote Method Invocation (RMI), 252–254
replaceAll( ) function, collections, 273
ResultSet objects, querying tables, 298–299
reuse, Java support for, 77
reverse( ) function, collections, 273
RMI (Remote Method Invocation), 252–254
rounding functions, BigDecimals, 205–206
run( ) method
implementing Runnable interface, 232–233
Runnable interface, 232–233, 238–240
runtime
Eclipse, 362
garbage collection at, 236–237
optimizing strings at, 191
RuntimeException class, 221–222, 228
s class. see derived classes
SAX (Simple API for XML) parsing interface, 340
schemas, XML, 339
scope, local variable, 170–172
SDK (Software Development Kit)
development of, 20
searches, XML-based, 352
security, EJB, 324
seek( ) method, RandomAccessFile, 257
SELECT statement, 244
semaphore tool, 234
Serializable interface, 252–254
servlet engine
overview of, 310
processing JSPs, 315
browsers and Web servers, 308–310
design principles for, 307
Java Server Pages and, 314–316
as transaction processor, 310
Session objects, creating, 313
SessionBeans, EJBs, 323, 326–327
Set interface, collections
caution about, 272
defined, 265
HashSet implementation, 271
setErrorMsg method
inheritance exercises, 134, 136–138, 140–145
polymorphism, 132
setMsgText method, 133–134, 144
setOut( ) method, PrintStream, 245
SGML (Standard Generalized Markup Language), 330
sharing, methods and variables, 126
signature, subroutine, 9
Simple API for XML (SAX) parsing interface, 340
single-type-import declaration statement, 31
16-bit Unicode characters, Java Strings, 190
size, Vectors and ArrayLists, 267–268
slashes (//), 153
sleep() method, threads, 239, 241
Software Development Kit. see SDK (Software Development Kit)
sort( ) function, collections, 273
SortedSet interface, collections
Comparator interface and, 275
defined, 265
TreeSet implementation of, 272
SQL
JDBC support for, 294
querying tables using, 298–299
src directory, Eclipse, 360
standalone interpreters, 34
standard doclet, Javadoc, 286
Standard Generalized Markup Language (SGML), 330
stateful SessionBeans, EJBs, 323
stateless SessionBeans, EJBs, 323
statements, Java
COBOL vs., 150
in code blocks, 167
flow control. see flow control, Java
static initializer code, 88–89
static keyword, 131
static methods, 70
StAX (Streaming API for XML) interface, 340
stop processing variables, 231
stopThread( ) method, 231–233, 238–240
Streaming API for XML(StAX) interface, 340
StringBuffers, 200–201, 213–214
subclasses
defined, 102
Exception class hierarchy, 221
inheritance and, 31–32, 103–104
subroutines
COBOL, 4
reusing in complex environments, 112–119
Sun, integrated development environments, 20–21
super keyword, 131
hiding methods and members, 131
inheritance and, 103
inheritance as design pattern and, 109
inherited methods, extending, 106–108
inherited methods, redefining, 105–106
overview of, 102
swap( ) function, collections, 273
Swing class graphical libraries, 20, 280–281
switch statement, 176–177, 181
sysedit function, 22
System icon, Control Panel, 22
System.out.printIn( ) method
displaying information on console with, 244–245
Java compile and execution, 18–19
overview of, 35
tables, querying database, 298–299
tags, JSP, 316
templates, Java interfaces as, 129
text editors
creating HelloWorld.java, 24
getting started with SDK, 22
writing programs in Java with, 20
TextMessage class sample
extending methods, 107
hiding methods and members, 131
hiding variables and methods, 127
inheritance, 119–124, 126, 134–136
redefining methods, 105
sharing variables and methods, 126
TEXT-STRING, 39
benefits and cautions, 235–236
implementing Runnable, 232–233
Throwable class, 221
timeToStop( ) method, threads, 231, 238–240
Toggle Breakpoint option, Eclipse, 362
Tomcat Web server, 316–317, 319
top-down implementation, inheritance, 102
transaction contexts, EJBs, 324
transaction logic, updating database, 297
transaction processors, servlets as, 310
TreeSet, 272
try...catch code blocks, 223–226, 228–229
type-import-on-demand declaration statement, 31
Types 1 - 4 JDBC drivers, 294–295
UML (Universal Modeling Language), static classes, 128
unboxing, 199
underscore character (_), 150
Unicode format
comparing Java strings, 194
double-byte, 254
XML document characters similar to, 337
Universal Modeling Language (UML), static classes, 128
URI type file specification, 247
URL (Uniform Resource Locator)
CODEBASEs defined by, 28
UTF-8 coding scheme, XML declarations, 337
value-added networks (VANs), EDI services, 342
VANs (value-added networks), EDI services, 342
variables
clarifying for this operator, 127–128
defined, 71
sharing methods and, 126
stop processing, 231
Vector collection class, 264, 266–270
virtual machine environment, 18
Web servers
servlet engines operating as, 310
while statement
defined, 181
do...while statement vs., 174
for statement vs., 176
Windows 98, Me, XP, Vista, 2000 and 2003, 22
WordPad, 22
WORKING-STORAGE area, COBOL
class variables vs., 70
DTD comparable to, 334
implementing inheritance, 116–119
private items in, 10
Workspace Launcher, Eclipse, 357
write( ) method, OutputStream, 251
WRITE file, 244
writing data
x++ (postfix) operator, Java, 155
XBRL (Extensible Business Reporting Language), 352
XML (Extensible Markup Language), 329–354
authoring XML documents, 339
basics of, 330
complete XML documents, 338
document type definitions, 332–333
Electronic Data Interchange, 342–343
OAG specifications for, 344–351
possible new application functions, 351–352
schemas, 339
Web services or online, 343–344
XML documents
authoring, 339
complete, 338
defined, 330
XSD (XML Schema Definition), 339
zip files
compressed packages, 33
jar files vs., 282
unpacking, 356