Exercise 3-15 (Hello, world with Javadoc)
Chapter_3 Exercises_3-13,14 | Package_Access Exercise_3-16 |
Exercise 3-15 TIJ, p. 61
Exercise 3-15: (1) Take the program in Exercise_3-2 and add comment documentation to it. Extract this comment documentation into an HTML file using Javadoc and view it with your Web browser.
Hello.java
/**
* Main (and only) class of the greeting program.
*/
public class Hello
{
/**
* Prints a greeting message.
* @param args Command line arguments as
* {@link java.lang.String Strings}.
* @throws exceptions No exceptions thrown
*/
public static void main(String[] args)
{
System.out.println("Hello, world!");
}
}
/*
javac Hello.java
java Hello
Hello, world!
javadoc Hello.java -d doc \
-link https://docs.oracle.com/en/java/javase/21/docs/api/
*/
Note: See the Notes at the end of Exercise_3-12.
Chapter_3 Exercises_3-13,14 | BACK_TO_TOP | Package_Access Exercise_3-16 |
Comments
Post a Comment