Answers for "how to write if else condition in java"

5

if else in java

import java.io.*;
public class JavaIfElse
{
   public static void main(String[] args)
   {
      int number = 15;
      // check if number is divisible by 2
      if(number%2 == 0)
      {
         System.out.println(number + " is even number");
      }
      else
      {
         System.out.println(number + " is odd number");
      }
   }
}
Posted by: Guest on January-15-2021
5

if else in java

import java.io.*;
public class JavaIfElse
{
   public static void main(String[] args)
   {
      int number = 15;
      // check if number is divisible by 2
      if(number%2 == 0)
      {
         System.out.println(number + " is even number");
      }
      else
      {
         System.out.println(number + " is odd number");
      }
   }
}
Posted by: Guest on January-15-2021
1

how to make if else statments in java

if (condition) {
  // code block
} else {
  // code block
}
Posted by: Guest on April-15-2021
1

how to make if else statments in java

if (condition) {
  // code block
} else {
  // code block
}
Posted by: Guest on April-15-2021

Code answers related to "how to write if else condition in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language