Java Documentation Style and Code Examples
Documentation Style
UAB E&CE students are expected to code their Java programs in accordance with
a published documentation style documented on this site.
Code
Generally speaking, the viewable source files are merely the
original source files which have been renamed from xyz.java to
xyz_java.txt so as to trigger the correct MIME type on the
server. (The Learn Java information is
formatted HTML.)
- Hello World (command line)
viewable source |
source |
class
- Hello World (applet)
viewable source |
source |
class |
applet
(done with VJ++ 1.1, so longer than necesary)
- Hello World (applet/command line)
viewable source |
source |
class |
applet
(support code:
viewable source |
source |
class)
- Hello World (applet, trimmed down, graphic)
viewable source |
source |
class |
applet
-
Learn (basic) Java IO Series
- Info1
viewable source |
source |
class
command line, access system information
- ArgsDemo
viewable source |
class
command line, try running it to understand what String args[] means
- Hello World (command line)
viewable source |
class
- Scribble viewable source |
class |
applet
- URLPlay
viewable source |
class
- GetURLInfo (applet)
viewable source |
class |
applet
- SimpleClient (InetAddress)
viewable source |
class
- ReadFile viewable source |
class |
test.txt (test file)
- ReadFileChar
viewable source |
class |
test.txt
- Fields0
viewable source |
class |
javadoc output |
test.txt
- TwoClassDemo
viewable source |
class |
output
Rectange
viewable source |
class
Square viewable source |
class
- FlipFlop Fun -
DFlipFlop viewable source |
class |
output |
Ripple viewable source |
class |
output
-
Use of (int) casting versus the Round() method for mapping
random numbers of a die to achieve the proper statistics for
the roll.
viewable source |
class
-
IniFile Fun
- Serialization -
Serialized viewable source |
class
- Execute program -
Execute "ping" |
class |
Execute from a specified directory |
class
- String wrapper on Stack object -
source code |
class
- SimpleGuiDemo -
source code |
class |
Applet Demo
- GraphicDemo (a .gif image ((.jpg works also))) -
source |
class |
applet
- UDP DatagramSocket Information -
source |
class
- UDP Transmission -
source |
class
- UDP Send/Receive (receive is only in response to send) -
source |
class
- JUnit Demo
-
almost
useless FileDialogExample
-
TextArea Demo
-
JOptionPane.showInputDialog
Example
- DateDemo source | class
- GridBagLayout source | class
- Unit Test Structure without actually testing anything
- ToDo and Unit Tests
- scanner demo: Driver | class |
Shape | class |
Circle | class |
Rectangle | class |
Square | class
-
Autoexecuting JAR file (More info) |
Notes |
Hello.java |
Hello.class |
Addition to manifest: mainClass.txt |
Resulting jar file
-
Counter and
CounterTest
(2008 JUnit/DrJava demo)
- JKFF Model source | class |
Test Code source | class (20090827 DrJava Demo) |
JUnit Test Source | Class (20090908)
- Determining the class version
- Line - Assert ExampleSource | Class
- FileFun.java -- Count files (and directories) in a directory with File (recursion)
- Metrics.java | MetricsTest.java OO version of the above with Unit Test
- LineOrientedScannerDemo.java shows how to read a line like
command<enter>
and
command<enter>
without any blocking.
- Line Separators in Java: NewLines.java | NewLines.class
- Walking through a HashMap
- Loading an image from a file into an ImageView widget in JavaFX
General Comments
Sun Command Line Tool (notes)
- javac - Command line compiler
- java - their VM runnable from command line
- jdb - their command line debugger
- CLASSPATH - environmental variable point to where
classes are stored
- jar - an archiver/de-archiver
David Green
Last modified: 20200205