From 17a41b84a61e2185236c95a1856150599f3d41fb Mon Sep 17 00:00:00 2001 From: uvhareesh Date: Thu, 15 May 2025 22:40:26 +0530 Subject: [PATCH] control statements - conditional statements - if --- src/controlStatements/IfCondition.java | 14 ++++++++++++++ src/controlStatements/IfElseCondition1.java | 19 +++++++++++++++++++ src/controlStatements/IfElseCondtion.java | 19 +++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 src/controlStatements/IfCondition.java create mode 100644 src/controlStatements/IfElseCondition1.java create mode 100644 src/controlStatements/IfElseCondtion.java diff --git a/src/controlStatements/IfCondition.java b/src/controlStatements/IfCondition.java new file mode 100644 index 0000000..4974ed7 --- /dev/null +++ b/src/controlStatements/IfCondition.java @@ -0,0 +1,14 @@ +package controlStatements; + +public class IfCondition { + + public static void main(String[] args) { + int person_age=25; + if(person_age>=18) // always boolean expression + { + System.out.println("Person is eligible for Voting"); + } + + } + +} diff --git a/src/controlStatements/IfElseCondition1.java b/src/controlStatements/IfElseCondition1.java new file mode 100644 index 0000000..b77e122 --- /dev/null +++ b/src/controlStatements/IfElseCondition1.java @@ -0,0 +1,19 @@ +package controlStatements; + +public class IfElseCondition1 { + + public static void main(String[] args) { + + int a=10; + + if(a%2==0) + { + System.out.println("Even number"); + } + else + { + System.out.println("Odd number"); + } + } + +} diff --git a/src/controlStatements/IfElseCondtion.java b/src/controlStatements/IfElseCondtion.java new file mode 100644 index 0000000..0e1743a --- /dev/null +++ b/src/controlStatements/IfElseCondtion.java @@ -0,0 +1,19 @@ +package controlStatements; + +public class IfElseCondtion { + + public static void main(String[] args) { + int person_age=17; + if(person_age>=18) // always boolean expression + + { + System.out.println("Person is eligible for Voting"); + } + else + { + System.out.println("Person is not eligible for Voting"); + } + + } + +}