Answers for "boolean method java example"

2

bool in java

class App {
 public static void main(String[] args) {
  // The boolean keyword is for creating a variable with boolean data type.
   boolean result = true;
   System.out.println(result);
 }
}
Posted by: Guest on September-07-2021
-1

boolean method java example

javaCopypublic class booleanMethod {
  
    public static boolean isEven(int mynumber)
    {
        return (mynumber % 2 == 0);
    }

    public static void main(String[] args)
    {
        int mynumber = 130;
        if(isEven(mynumber) == true)
            System.out.print("Even Number");
        else
            System.out.print("Odd Number");
    }
}
Posted by: Guest on September-11-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language