Addition Of Two Numbers in Java Netbeans6.5.1.

Q1. Design a Java Netbeans 6.5.1 GUI application to find out addition of two numbers?

Sol:

Create a GUI application as per following screenshot.

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

//declaring variables

int x,y,z;

 

//This statement will obtain a numeric value from the textfield.

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

y=Integer.parseInt(txt2.getText());

z=x+y;

 

//set as text in textfield.

lbladd.setText(z+” “);

 

 

Output of the above program will be:

Leave a Reply

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