Commit 9efc0a7
committed
docs: add Javadoc documentation for Library Book class
WHAT was added:
- Created `JAVADoc` class as a demo for Java documentation comments.
- Added metadata tags at the top of the file:
• @author → Somesh Diwan
• @Version → 1.0
• @SInCE → 2025
- Documented a static field `val` with @value indicating its default value.
- Provided Javadoc for constructor and methods with appropriate tags:
• @param → describes method parameters (e.g., book name, roll number, ID).
• @throws → documents possible exceptions (in `issue()` method).
• @return → explains return values (boolean for availability, String for book name).
KEY LEARNINGS:
1. Javadoc Tags:
- @author → credits class author.
- @Version → specifies version of class.
- @SInCE → indicates when feature/class was introduced.
- @param → explains parameters of method/constructor.
- @return → explains returned value of method.
- @throws → documents exceptions a method may throw.
- @value → documents constant values.
2. Benefits:
- Generates professional HTML documentation using `javadoc` tool.
- Makes APIs self-explanatory and easier for other developers.
- Acts as a single source of truth for class behavior and usage.
REAL-WORLD APPLICATIONS:
- ✅ Library or API design: Every public method and class is documented for external users.
- ✅ Enterprise projects: Standard practice for maintainability and onboarding new developers.
- ✅ Open-source contributions: Essential for community-driven projects to explain features clearly.
- ✅ IDE Integration: Tools like IntelliJ and Eclipse show Javadoc tooltips inline for better developer productivity.
RULE OF THUMB:
- Always document public classes, methods, and fields.
- Use concise but clear descriptions.
- Include @throws and @return wherever applicable.
- Keep Javadoc updated as code evolves.
Signed-off-by: https://github.com/Someshdiwan <[email protected]>1 parent 1b4972d commit 9efc0a7
1 file changed
+3
-4
lines changedLines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
| 26 | + | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
| 54 | + | |
0 commit comments