Thanks for this info
________________________________ From: Vinay.maddi <[email protected]> To: "[email protected]" <[email protected]> Cc: "[email protected]" <[email protected]> Sent: Sat, November 28, 2009 5:16:24 AM Subject: Re: [java programming] some beginner blues Hello In java a file can have any number of classes ...but a file can have only one public class and file name should match that public class If you uSe an IDE it will take care of this Thanks V On Nov 27, 2009, at 12:54 PM, Elvis Hektor Ratzlaff Koop <[email protected] > wrote: > Hi Bryan > > As Far I understand your problem. > Your public class and your file name must be the same.. > > If your pulic class name is "InputFromKeyboardJOptionPane" your file > name must be > InputFromKeyboardJOptionPane.java > > On Fri, Nov 27, 2009 at 12:54 PM, R Bryan Irwin <[email protected]> > wrote: >> 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 > > > > -- > --- > Public PGP key: > http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF4CC08C5 > > -- > 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 -- 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 -- 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
