Εσωτερική και εξωτερική τεκμηρίωση
-
Η εσωτερική τεκμηρίωση βοηθά στην καλύτερη διαχείριση και οργάνωση του κώδικα.
- Υπάρχουν συστήματα που μετατρέπουν την τεκμηρίωση αυτή και σε εξωτερική
τεκμηρίωση.
Παράδειγμα:
/**
* A class containing static methods that allow the simple, correct,
* and efficient procesing of a console application's standard input
* and output streams.
* Output is buffered, but automagically flushed, so that prompts in
* interactive applications work as expected.
* All errors will terminate the application with an error message.
* The code was written to provide an easy-to-learn and consistent interface
* for learning Java. It is not intended for production work.
*
* @author Diomidis Spinellis
* @version $Revision: 1.4 $
* @see java.io
* @see java.io.Writer
* @see java.io.PrintWriter
*/
public class BIO {
// Reader and Writer
private static BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
private static PrintWriter out =
new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
private static boolean needFlush = false;
// Class initializer
static {
Runtime.getRuntime().addShutdownHook(new Thread() {
// Will run when VM shuts down
public void run()
{
try {
in.close();
out.close();
} catch (Exception e) {
}
}
});
}
/**
* Flush the output stream. If the stream has saved any characters from
* the various write() methods in a buffer, write them immediately to
* their intended destination.
* Flushing is automatically performed before reading input from a
* source * that could be affected by reading the program's output
* (e.g. a human).
*/
public static void flush() { out.flush(); needFlush = false; }
/** Print the argument of type char on the standard output. */
public static void print(char x) { out.print(x); needFlush = true; }
/** Print the argument of type int on the standard output. */
public static void print(int x) { out.print(x); needFlush = true; }
/** Print the argument of type boolean on the standard output. */
public static void print(boolean x) { out.print(x); needFlush = true; }
/** Print the argument of type double on the standard output. */
public static void print(double x) { out.print(x); needFlush = true; }
/** Print the argument of type Object on the standard output. */
public static void print(Object x) { out.print(x); needFlush = true; }