-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHello.java
More file actions
60 lines (53 loc) · 1.34 KB
/
Hello.java
File metadata and controls
60 lines (53 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* This is the Hello class, demonstrating JavaDoc usage.
* It includes methods for greeting, addition, and displaying information.
*
* @author Nilesh Ghavate
* @version 1.1
* @since 2025-03-08
*/
public class Hello {
/**
* Default constructor for the Hello class.
* Initializes the Hello object.
*/
public Hello() {
// Default constructor
}
/**
* Prints a welcome message.
*/
public void greet() {
System.out.println("Hello, welcome to JavaDoc!");
}
/**
* Adds two numbers and returns the sum.
*
* @param a The first number
* @param b The second number
* @return The sum of a and b
*/
public int add(int a, int b) {
return a + b;
}
/**
* Displays information about the author.
*
* @return A string containing the author's name and version
*/
public String getAuthorInfo() {
return "Author: Nilesh Ghavate, Version: 1.1";
}
/**
* The main method to execute the program.
*
* @param args Command-line arguments
*/
public static void main(String[] args) {
Hello hello = new Hello();
hello.greet();
int sum = hello.add(10, 20);
System.out.println("Sum: " + sum);
System.out.println(hello.getAuthorInfo());
}
}