-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsing
More file actions
29 lines (27 loc) · 790 Bytes
/
sing
File metadata and controls
29 lines (27 loc) · 790 Bytes
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
public class MyMethods {
public static void greet(String name) {
System.out.println("Hello, " + name + "!");
}
public static int add(int a, int b) {
return a + b;
}
public static void main(String[] args) {
greet("Alice"); // Output: Hello, Alice!
int result = add(15, 20);
System.out.println("Sum: " + result); // Output: Sum: 35
}
}
public class PrintNumbers {
public static void main(String[] args) {
for (int i = 1; i <= 5; i++) {
System.out.println(i); // Prints numbers from 1 to 5
}
}
}
public class PrintNumbers {
public static void main(String[] args) {
for (int i = 1; i <= 5; i++) {
System.out.println(i); // Prints numbers from 1 to 5
}
}
}