469,575 Members | 1,498 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

JOptionPane help

1
Hey, I'm totally new to Java, and I'm taking a class. My current assignment involves inputting 2 names and corresponding bdays for each name using the JOptionPane.showInputDialog etc. Anyway, I'm confused by Sun's site and I keep getting error messages. Below is what I have and the error message when I try to compile. Any help would be much appreciated. Thanks!

package javaapplication1;

/**
*
* @author Jillian
*/
public class asg1 {
//This is a programme designed to output older or younger.
public static void main(String[] args) {
System.out.println("Author: Jillian);
int name1 = JOptionPane.showInputDialog("Input the first name:");
}

}

symbol : variable JOptionPane
location: class javaapplication1.asg10
int name1 = JOptionPane.showInputDialog("Input the first name:");
1 error
BUILD FAILED (total time: 3 seconds)
Jul 4 '06 #1
2 2880
heat84
118 100+
Hey, I'm totally new to Java, and I'm taking a class. My current assignment involves inputting 2 names and corresponding bdays for each name using the JOptionPane.showInputDialog etc. Anyway, I'm confused by Sun's site and I keep getting error messages. Below is what I have and the error message when I try to compile. Any help would be much appreciated. Thanks!

package javaapplication1;

/**
*
* @author Jillian
*/
public class asg1 {
//This is a programme designed to output older or younger.
public static void main(String[] args) {
System.out.println("Author: Jillian);
int name1 = JOptionPane.showInputDialog("Input the first name:");
}

}

symbol : variable JOptionPane
location: class javaapplication1.asg10
int name1 = JOptionPane.showInputDialog("Input the first name:");
1 error
BUILD FAILED (total time: 3 seconds)

The JOptionPane.showInputDialog method returns a string so instead of int name1 it should be String name one or alternatively you can parse the string and make the variable name1 an integer.
Nov 13 '07 #2
r035198x
13,262 8TB
The JOptionPane.showInputDialog method returns a string so instead of int name1 it should be String name one or alternatively you can parse the string and make the variable name1 an integer.
An even more worrying thing is that JOptionPane itself was never imported. It is in the javax.swing package.
Nov 13 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by - Steve - | last post: by
1 post views Thread by jazzy | last post: by
1 post views Thread by Smarteric | last post: by
5 posts views Thread by Ramola | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.