See: http://java.sun.com for information on
obtaining Java 2 and for documentation and tutorial information
Note:
The first 12 handouts below are intended to review material that you should
already know, and we will not be directly discussing them in lecture. However, they do have a lot of worthwhile
comments, so I recommend reading over them even if you are already familiar
with the material. Note to the note:
Some of the first group of handouts below are fairly old and have not been
updated for more recent versions of Java.
ex1a.java ex1b.java – Simple Java
application, using console and using dialog boxes
ex2.java ex2b.java – Java control
structures and primitive data types
ex3.java – Java reference variables and parameters
ex4.java arraytest.java –
Simple intro. to Java arrays and shallow copying
ex5.java People.java Worker.java Student.java Sort.java ex5.mani ex5.jar
poly.cpp – Simple demonstration of inheritance,
polymorphism, and Java interfaces. The
procedure for creating and using a .jar file is also discussed. Simple polymorphism C++ is also included (in
case you are curious).
ex6.java ex6.html ex6a.java
ex6a.html – Simple Java applet, done with Swing
(ex6.java) and without (ex6a.java).
ex7.java – Simple demonstration of Java exceptions and
exception propagation
MiniCalcTwo.java DoMathInt.java
DoMathIntCheck.java – Demo of exceptions in a
graphical application
ex8.java – Simple example of some graphics abilities of
Java
ex9.java – Intro. to Java
graphical components and event-driven programming
ex10.java – Demo. of various MouseEvents in Java
ex11.java – Panels, Menus and some other graphical
components
ex12a.java ex12b.java ex12c.java ex12c.html – 12a)
Swing application showing rendering problems (due to buttons being drawn
through Java graphics) 12b) Solving the rendering problem via panels 12c) Same functionality as 12b but now as an applet
Updated Handouts for Summer 2009 Term Start Here
ex13.java – Review of graphical, event-driven programming
in Java
Bounce.java – Simple introduction to multithreading in
Java, using a subclass of Thread
Bounce2.java – Multithreading using the Runnable interface – compare to Bounce.java
ex14.java – Demonstration of arbitrary switching out of
competing Threads
BounceKey.java – Demonstration of problems associated
with Threads sharing data
BounceKeySynch.java – Fixing the problem with
synchronized methods and blocks
ex15b.java – Another demo of synchronization
Consumer.java – Demonstration of cooperation
synchronization utilizing wait() and notify()
ConsumerB.java – Alternative syntax using Lock and
Condition interfaces
JRServer.java ex16.java –
Simple example of a Java server and client
SendToMe.java ISend.java –
Another simple server / client example
TwoWayServer.java TwoWayClient.java
– Server and client with two-way communication
ImprovedChatServer.java ImprovedChatClient.java – Simple chat server
and client
signedChat
– Demonstration of signing applets to give more access and detect tampering