Design Java Netbeans 6.5.1 GUI application to find out that entered number is EVEN or ODD.

Q7. Design Java Netbeans 6.5.1 GUI application to find out that entered number is EVEN or ODD.

Sol:

Create a GUI application as per following screenshot.

Type the following code by double clicking BtnFind, button, below the line that says, ‘// TODO add your handling code here’

int num;

num=Integer.parseInt(txt1.getText());

if(num%2==0)

lblmsg.setText(“Number is EVEN.”);

else

lblmsg.setText(“Number is ODD.”);

}

OUTPUT:

 

When EVEN number is entered.

 

When ODD number is entered.

Leave a Reply

Your email address will not be published. Required fields are marked *

28 Views
%d bloggers like this: