// even & odd numbers: using "mod" import javax.swing.JOptionPane; public class even_odd { public static void main(String args[]) { // Prompt the user to enter a number: String numString = JOptionPane.showInputDialog(null, "Enter a number from 1 to 10:", "Input Window Demo", JOptionPane.QUESTION_MESSAGE); // Convert the string into an int value int num = Integer.parseInt(numString); // Display the result in a message dialog box if ( ( num % 2 ) == 0 ) System.out.println(" The number " + num + " is even."); else System.out.println(" The number " + num + " is odd."); System.exit(0); } }