input ang message box

Ads

 
 

Share on Google+Share on Google+

aldwin
input ang message box
1 Answer(s)      7 years ago
Posted in : Java Beginners
Ads
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 ang message box - Java Beginners
input ang message box  can you help me to calculates for the sum, difference, product and quotient of the two inputted values using Input Dialog Boxes. Show the result with Message Dialog Boxes. Set the Message Dialog Box Type
input box
input box  give me the code of input box in core java
Advertisements
input box
input box  give me the code of input box in core java
message box
message box  How to show the message "invalid username and password" after redirecting the page to the login form
How to create an input box?
How to create an input box?  How to create an input box
Changing the message box to a specific color
Changing the message box to a specific color  How do you change the message box color to a specific color? I can get the color to change with each... the message box to red but its not really working. Can you help me
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
Java Message Box - Java Beginners
Java Message Box  I want to display the variable value in message box...); But the message box display nothing. Is there any way to display the value of s in message box. Please help me as soon as possible.  Hi
Show input dialog box
on the "Ok" button of the input dialog button then a message dialog box... Swing Input Dialog Box Example - Swing Dialogs       Input dialog box is very important
confirm message box - Java Beginners
confirm message box  How can I create a confirm message with Yes and No button instead of OK/Cancel buttons in java script inside a jsp?   ... Title', 'My Confirm Message', 2,0,0) if (retVal==true) return true; else
Show message and confirm dialog box
Show Message and Confirm Dialog Box - Swing Dialogs... types of message box. There are three types of message dialog box that you can.... Once you click on the first button then the simple message box will open which
how do you change the message box to a specific color
how do you change the message box to a specific color  How do you change the message box color to a specific color? I can get the color to change... the message box to red but its not really working. Can you help me
how to add save,discard,& cancel button in a message box - Struts
how to add save,discard,& cancel button in a message box  how to add save,discard,& cancel button in a message box
input type dialog box take text and search a list and focus that text - JSP-Servlet
input type dialog box take text and search a list and focus that text  i have a button..when i press it will prompt a dialog box with a text box... then it will search a list which contains data in the same page and if found
input
input  a java program that will exchange the last names of two students that were input by a user
Show Dialog Box in Java
;    Message dialog box is used to display informative... the message Dialog box. Our program display "Click Me" button on the window and when user clicks on it program displays Message box with "OK"
jQuery 'select' form event
input box. In this Example, two input text box are given , when we select something inside text box , it will display message "Some text...; Click and drag the mouse to select text in the input box. </p>
Flex Alert Box example
Flex Alert Box example       Alert box is a dialog box that appears on window with some message and stays rigid until the event associated with it is not done. Alert
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
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
What is the difference between $message and $$message?
What is the difference between $message and $$message?  What is the difference between $message and $$message
message passing
message passing  how message is passed using jade technology
Hollow Box
){ Box b=new Box(); Scanner input=new Scanner(System.in); int menu = 0...Hollow Box  Write an application program that will draw a hollow box (a box with empty space in between). The program will ask the user to key
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
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
JSF message Tag
; <h:message for="input_text" /><br>   ...;true" for the input field. The message tag shows the error message related...;    Enter text in this box :<br>    <input
Display alert box on clicking link
Display alert box on clicking link In this tutorial, we will display alert box to prompt message using jQuery. In the below program , html page contains a "a href" link. On clicking this link ,a alert box prompt message
Tutorials   
Java Spring Hibernate Struts Training What type of programming language is Java? How do beginners learn about Java? ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017

Ads

 
Advertisement null

Ads