need some examples to experiment on.thanks by the way
Printable View
need some examples to experiment on.thanks by the way
What do you mean by 2 strings, you want to have 2 input boxes in the same JOptionPane?
hmm i mean
like this
int = a, b result= 0;
double = c result =0;
then
String str1,str2;
is that right?
hmm i mean
like this
int = a, b result= 0;
double = c result =0;
then
String str1,str2;
is that right?
First of all you are declaring variables wrong. To declare integers you must declare them like this:
Code:int a, b, result = 0;
This will create 3 variables. 'a' and 'b' which have no values assigned and 'result' which is given the value of 0. Do this also with your double variables. The strings you have correct, but I'm wondering why you asked about JOption?
I'm sorry if I'm not fully understanding your question. What are you trying to do exactly? What is the program?
The values work fine for me, are you having trouble doing the calculations for output?
Take a look through this: Examples of java.lang.Math Methods
It has examples of the Math Functions and it has everything you need to complete your program.
No problem, and good luck!
One new thread for every little question?
http://www.java-forums.org/new-java/...e-joption.html
What's the next? let me quess
Can someone give a sample for JOption with 3 strings?
db
The OP should read the API documentation for that class; it's all in there. The OP has polluted this forum more than enough with repetative questions about this class without showing any effort (nor creativity) to solve the 'problems' (mind the quotes). I'd say back to the API documentation.
kind regards,
Jos
What do you need to do with the strings? Compare them to each other?
I know, but what if the first string is not equivalent to the second string? Should it output something like... "String1 is not equal to String2"? Or are there no specific directions?
So doing something like this would be okay then? You just would use the strings like any other variable.
Code:System.out.print(str1 + " is Equivalent to " + str2);