Skip to content

Commit 030b995

Browse files
committed
feat: Add Basics class demonstrating if statement and while loop
Add a simple program that: - Checks a condition using an if statement - Prints "Hello World" if the condition is true - Uses a while loop to print numbers from 1 to 4 - Demonstrates basic conditional and iterative control flow in Java.
1 parent 2505077 commit 030b995

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed
Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
public class Basics {
22
public static void main(String[] args) {
3-
// int a = 10;
4-
// if (a == 10) {
5-
// System.out.println("Hello World");
6-
// }
7-
// int count = 1;
8-
// while(count != 5) {
9-
// System.out.println(count);
10-
// count++;
11-
// }
3+
int a = 10;
4+
if(a == 10) {
5+
System.out.println("Hello World");
6+
}
127

13-
// for loop
14-
for(int count = 1; count != 5; count++) {
8+
int count = 1;
9+
while(count != 5) {
1510
System.out.println(count);
11+
count++;
1612
}
1713
}
1814
}

0 commit comments

Comments
 (0)