This tutorial will teach you How to Find Odd or Even Numbers using Java Swing.
Paste the Code Inside the Ok Button
1 2 3 4 5 6 7 8 9 10 11 | int num = Integer.parseInt(txtnum.getText()); if(num % 2 == 0) { JOptionPane.showMessageDialog(this, num + " : is Even "); } else { JOptionPane.showMessageDialog(this, num + " : is Odd "); } |
i have attached the video link below. which will do this tutorials step by step.