input ang message box

Ads
 

input ang message box

View Answers

July 15, 2009 at 11:17 AM

Hi Friend,

Try the following code:

import java.awt.*;
import javax.swing.*;

public class Calculate{
public static void main(String[] args)
{
String input1 = JOptionPane.showInputDialog("Input First Number");
int num1=Integer.parseInt(input1);
String input2 = JOptionPane.showInputDialog("Input second Number");
int num2=Integer.parseInt(input2);
int sum=num1+num2;
int diff=num1-num2;
int mul=num1*num2;
int quo=num1/num2;
JOptionPane.showMessageDialog(null,"Addition of numbers is: "+sum);
JOptionPane.showMessageDialog(null,"Difference of numbers is: "+diff);
JOptionPane.showMessageDialog(null,"Multiplication of numbers is: "+mul);
JOptionPane.showMessageDialog(null,"Quotient of numbers is: "+quo);
}
}

Thanks

Ads









Related Tutorials/Questions & Answers:
input box
input box  give me the code of input box in core java
input box
input box  give me the code of input box in core java
Advertisements
message box
message box  How to show the message "invalid username and password" after redirecting the page to the login form
Java Message Box
. By message box we mean a box in which message is displayed or a box from which input.../No. showInputDialog : This will display a message box that accept input from user from text...Java Message Box In this tutorials you will learn about how to create Message
Message Box Java
In this section we will create a message box in Java using a Java API class. A certain message, warning or information can be displayed in this message box. Generally the message box is used to display error message. JOptionPane class
input
input  a java program that will exchange the last names of two students that were input by a user
Java Alert Box
JOptionPane class to display the message alert box.  JOptionPane class is available...Java Alert Box In this example we will describe java alert box. First of all we have created class than main method after that we have created alert box
What is the difference between $message and $$message?
What is the difference between $message and $$message?  What is the difference between $message and $$message
difference between $message and $$message
difference between $message and $$message  What is the difference between $message and $$message?   Hi friends, $message is a simple variable whereas $$message is a reference variable. Example: $name = 'Bharat
message passing
message passing  how message is passed using jade technology
ModuleNotFoundError: No module named 'box-box'
ModuleNotFoundError: No module named 'box-box'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'box-box' How to remove the ModuleNotFoundError: No module named 'box-box
ModuleNotFoundError: No module named 'box-box'
ModuleNotFoundError: No module named 'box-box'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'box-box' How to remove the ModuleNotFoundError: No module named 'box-box
input output
Input And Output       Introduction The Java I/O means Java Input/Output and is a part... character input stream and buffering characters. It also reads
Array and input
to input one of the above numbers then i want to print the array without the number user input. how will i do tht
msg box in jsp
msg box in jsp  i need the source code to display the msgbox in jsp....but one condition is,i need to use it in the current page itself...now i use the message box means it prints it into another page...i need to resolve it plz
Popup dialog box in java
dialogs-user can customize dialog box. Here is a simple popup message dialog box...Popup dialog box in java  How to display popup dialog box in java?   Dialog Box- A dialog box is an independent small window which appear
javascript focus input
into it. Clicking the OK button on the alert box takes the focus to the name input field... the address. As you click on OK, focus reaches to the address input box automatically... javascript focus input
keyboard input
keyboard input  how do I use JOptionPane to accept keyboard input? I know how to import but not specific command on input line   import javax.swing.*; class JOPtionPaneExample { public static void main(String
input output
input output  java program using fileinputstream and fileoutputstream   Hi Friend, Try the following code: import java.io.*; class FileInputStreamAndFileOutputStream { public static void main(String[] args
input output
input output  java program using fileinputstream and fileoutputstream   Hi Friend, Try the following code: import java.io.*; class FileInputStreamAndFileOutputStream { public static void main(String[] args
select box and text box validations
select box and text box validations  hi, any one please tell me how to set validations for select box and text boxes using bean classes? thank you   Please visit the following link: http://www.roseindia.net/jsp/user
How to take input by user using jDialogue and use that input
this button a dialogue box appear which take employee_id as input from user . then that input be used for fethcing data from the database ( desired table in DB...How to take input by user using jDialogue and use that input  I am
dropdown box
dropdown box  i need to have country,state and city in drop down box using ajax and use db2 database   Have a look at the following link: JSP dependent dropdown
To Display the 'Last Modified' message in JSP
To Display the 'Last Modified' message in JSP  I have to display the "Last Modified" auto save message in a portlet page at the right end corner...; <td align="center"> <input type="text" size="3" maxlength="2" name
Select Box Validation in JavaScript
Select Box Validation in JavaScript In this section we will discuss about select box validation in JavaScript. Select box allows you to create drop down list.... The select tag is useful when you have to get the user input from the available
dialog box
dialog box to show latest question  hello. write an application that displays a series of at least four interview questions and each question should... of the interview, use a dialog box to ask whether the user wants to - enter another set
dialog box
dialog box to ask to quit or continue  hello. write an application that displays a series of at least four interview questions and each question... of the interview, use a dialog box to ask whether the user wants to - enter another set
combo box
combo box  Hi, [_|] dropdown box [ ] [INCLUDE... a screen like this using jsp-servlet(or DAO,DTO),in that drop down box i should get
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box

Ads