Added progra for Java If else
This commit is contained in:
21
Java/java-basics/JavaIfElse.java
Normal file
21
Java/java-basics/JavaIfElse.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class JavaIfElse {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
int age = 20;
|
||||||
|
if (age < 18) {
|
||||||
|
System.out.println("You are not an adult.");
|
||||||
|
} else {
|
||||||
|
System.out.println("You are an adult.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ifStatement(String[] args) {
|
||||||
|
int age = 30;
|
||||||
|
if (age >= 18) {
|
||||||
|
System.out.println("You are an adult.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user