Odd and Even


The program is simple, but the implementation needs some explaination.

To take input from the program , we use the Scanner class, it is included as the java.utils.Scanner..

The class object needs to be initialized to use. The scanner object has the method nextInt() to take in an integer, as there is another method for nextFloat() or nextLine() to take in a string.


input() method is used which takes in the prompt as a String parameter.