Skip to content

Commit 191ee46

Browse files
authored
Merge pull request #4 from uvhareesh/develop
control statements - conditional statements - if
2 parents 455ebbd + 17a41b8 commit 191ee46

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package controlStatements;
2+
3+
public class IfCondition {
4+
5+
public static void main(String[] args) {
6+
int person_age=25;
7+
if(person_age>=18) // always boolean expression
8+
{
9+
System.out.println("Person is eligible for Voting");
10+
}
11+
12+
}
13+
14+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package controlStatements;
2+
3+
public class IfElseCondition1 {
4+
5+
public static void main(String[] args) {
6+
7+
int a=10;
8+
9+
if(a%2==0)
10+
{
11+
System.out.println("Even number");
12+
}
13+
else
14+
{
15+
System.out.println("Odd number");
16+
}
17+
}
18+
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package controlStatements;
2+
3+
public class IfElseCondtion {
4+
5+
public static void main(String[] args) {
6+
int person_age=17;
7+
if(person_age>=18) // always boolean expression
8+
9+
{
10+
System.out.println("Person is eligible for Voting");
11+
}
12+
else
13+
{
14+
System.out.println("Person is not eligible for Voting");
15+
}
16+
17+
}
18+
19+
}

0 commit comments

Comments
 (0)