I'm sorry about my beginner question but can't seem to find an answer.
In the following code, I have renamed the project in order to send it as
homework. Now, I receive the error 'class InputFromKeyboardJOptionPane is
public, should be declared in a file named
InputFromKeyboardJOptionPane.java'. I have done a clean rebuild and checked
the folder. There is no build file of that name so I don't know what to
refer it to. Any ideas? I think I just don't understand the organization of
the file structure here.
import javax.swing.JOptionPane;
~~public class InputFromKeyboardJOptionPane {~~
public static void main(String[] args) {
String name = "";
name=JOptionPane.showInputDialog("Please enter your name");
String msg = "Hello " +name+ "!";
JOptionPane.showMessageDialog(null,msg);
String age = "";
age=JOptionPane.showInputDialog("Please enter your age");
String msg2 = "You are " +age+ " years old.";
JOptionPane.showMessageDialog(null, msg2);
int ageint = Integer.parseInt(age);
if (ageint > 30){
JOptionPane.showMessageDialog (null, "You are a little old...");
}
else {
JOptionPane.showMessageDialog (null, "You are quite young...");
}
}
}
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en