Java Eclipse - Placing a space between my JOptionPane.showMessageDialog? -
i'm messing around in eclipse (beginner) , have gui made produce final output of, "your name john smith doe". however, when outputs final name, reads this, "your name johnsmithdoe". there no spacing between first, middle, , last name. how can add spacing between names? code below.
thank you,
don
string fn = joptionpane.showinputdialog("please enter name"); string mn = joptionpane.showinputdialog("please enter middle name"); string ln = joptionpane.showinputdialog("please enter last name"); string name = fn + mn + ln; joptionpane.showmessagedialog(null, "your name " + name, "name", joptionpane.plain_message);
you need include space characters in string: string name = fn + " " + mn + " " + ln;
Comments
Post a Comment