Skip to content

Commit 9efc0a7

Browse files
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

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Section21AnnotationsandJavaDoc/src/JAVADocumentaion.java renamed to Section21AnnotationsandJavaDoc/src/JAVADoc.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
* Class for Library Book
1111
*/
1212

13-
public class JAVADocumentaion
14-
{
13+
public class JAVADoc {
1514

1615
/**
1716
* @value 10 default value
@@ -24,7 +23,7 @@ public class JAVADocumentaion
2423
* @param s Book Name
2524
*/
2625

27-
public JAVADocumentaion(String s){
26+
public JAVADoc(String s){
2827
}
2928

3029
/**
@@ -52,4 +51,4 @@ public boolean available(String str){
5251
public String getName(int id){
5352
return "";
5453
}
55-
}
54+
}

0 commit comments

Comments
 (0)