DGreen Intranet -> Java Documenation Style and Code Examples

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.)

  1. Hello World (command line)  viewable source | source | class
  2. Hello World (applet) viewable source | source | class | applet (done with VJ++ 1.1, so longer than necesary)
  3. Hello World (applet/command line) viewable source | source | class | applet
    (support code:  viewable source | source | class)
  4. Hello World (applet, trimmed down, graphic) viewable source | source | class | applet
  5. Learn (basic) Java IO Series
  6. Info1 viewable source | source | class
    command line, access system information
  7. ArgsDemo viewable source | class command line, try running it to understand what String args[] means
  8. Hello World (command line) viewable source | class
  9. Scribble viewable source | class | applet
  10. URLPlay viewable source | class
  11. GetURLInfo (applet) viewable source | class | applet
  12. SimpleClient (InetAddress) viewable source | class
  13. ReadFile viewable source | class | test.txt (test file)
  14. ReadFileChar viewable source | class | test.txt
  15. Fields0 viewable source  | class | javadoc output | test.txt
  16. TwoClassDemo viewable source | class | output Rectange viewable source | class
    Square viewable source | class
  17. FlipFlop Fun - DFlipFlop viewable source | class | output | Ripple viewable source | class | output
  18. 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
  19. IniFile Fun
  20. Serialization - Serialized viewable source | class
  21. Execute program - Execute "ping" | class | Execute from a specified directory | class
  22. String wrapper on Stack object - source code | class
  23. SimpleGuiDemo - source code | class | Applet Demo
  24. GraphicDemo (a .gif image ((.jpg works also))) - source | class | applet
  25. UDP DatagramSocket Information - source | class
  26. UDP Transmission - source | class
  27. UDP Send/Receive (receive is only in response to send) - source | class
  28. JUnit Demo
  29. almost useless FileDialogExample
  30. TextArea Demo
  31. JOptionPane.showInputDialog Example
  32. DateDemo source | class
  33. GridBagLayout source | class
  34. Unit Test Structure without actually testing anything
  35. ToDo and Unit Tests
  36. scanner demo: Driver | class | Shape | class | Circle | class | Rectangle | class | Square | class
  37. Autoexecuting JAR file (More info) | Notes | Hello.java | Hello.class | Addition to manifest: mainClass.txt | Resulting jar file
  38. Counter and CounterTest (2008 JUnit/DrJava demo)
  39. JKFF Model source | class | Test Code source | class (20090827 DrJava Demo) | JUnit Test Source | Class (20090908)
  40. Determining the class version
  41. Line - Assert ExampleSource | Class
  42. FileFun.java -- Count files (and directories) in a directory with File (recursion)
  43. Metrics.java | MetricsTest.java OO version of the above with Unit Test
  44. LineOrientedScannerDemo.java shows how to read a line like command<enter> and command<enter> without any blocking.
  45. Line Separators in Java: NewLines.java | NewLines.class
  46. Walking through a HashMap
  47. Loading an image from a file into an ImageView widget in JavaFX

General Comments

Sun Command Line Tool (notes)

  1. javac - Command line compiler
  2. java - their VM runnable from command line
  3. jdb - their command line debugger
  4. CLASSPATH - environmental variable point to where classes are stored
  5. jar - an archiver/de-archiver

David Green

Last modified: 20200205