File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments