Java Odd or Even

Code Example to determine if a number entered is odd or even

import java.util.Scanner;

class OddOrEven {
public static void main(String args[]) {

int num;

System.out.println("Enter an Integer number:");

Scanner input = new Scanner(; 

num = input.nextInt();

if ( num % 2 == 0 )

System.out.println("The number is even");

System.out.println("The number is odd"); } }

Click here to see this code run

Java Fun Fact

Java was called Oak at the beginning

The original name for Java was Oak. Java legend has it that a big oak tree that grew outside the developer James Gosling’s window. 

More Free Code Examples:

JavaScript Substitution Cipher

Angular Click Counter


Popular posts from this blog

Multi-tap Keypad Text Entry

HTML5 Crossword 1