
CMSC 433, Alan Sussman, U. Maryland (via
Bill Pugh) 1
CMSC433, Spring 2002
Programming Language
Technology and Paradigms
Basic Java
Alan Sussman
January 31, 2002
CMCS 433, Spring 2002 -Alan Sussman 2
Administrivia
•Class accounts emailed yesterday
–see me if you didn’t get one
•Office hours posted for TA and me
–start today
•First Java project due Wednesday, 2/13, 6PM
–additional info will be coming, definitely before
Tuesday, so watch the web page
•Java readings from Thinking in Java
–we’ll do parts of many chapters, but definitely read
Chapter 1 for an overview
•Quiz
CMCS 433, Spring 2002 -Alan Sussman 3
What Makes Java Different
•Java fully specified
–e.g., constants, size of types, array bounds
checking, no dangling pointers
–language specification intended to completely
specify the behavior of allprograms
•not just correct ones
•all runtime errors must be caught
–KISS principle applied
•many useful, but not essential, features from C++
not included (operator overloading, templates,
multiple inheritance, standalone functions, …)
CMCS 433, Spring 2002 -Alan Sussman 4
Java semantics
•Machine architecture insensitive
–size of machine word
–floating point format (must use IEEE 754)
–big/little-endian
•Compiled to machine independent byte
code
•Many C++ programs break when moved to
machine with different word size or
endianness
CMCS 433, Spring 2002 -Alan Sussman 5
Java security
•Can strictly limit access to code
–untrusted code can’t access files and are
limited in network connectivity by default
•Compiled code (byte codes) can be verified
for correctness (by another program)
•But security bugs are still possible
–e.g., denial of service, insecure mode code
–but all C++ programs run in an insecure mode
CMCS 433, Spring 2002 -Alan Sussman 6
Java features
•Strong type system
•Multi-threading and synchronization
•Garbage collection
•Exceptions
•class Class
–classes are objects too
•class Object
–the class all classes are derived from