I need to prompt the user to enter their full name and once they do I need two separate messages to show them your first name is
and your last name is
. I have everything but what I need to code for the firstName
and lastName
string. I feel like it has something to do with indexOf
? but I can't get it to work correctly.
public class project2b {
public static void main (String [] args) {
String firstName;
String lastName;
String fullName;
firstName =
lastName =
fullName = JOptionPane.showInputDialog(null, "What is your full name?");
JOptionPane.showMessageDialog(null, " Your first name is " +
firstName);
JOptionPane.showMessageDialog(null, " Your last name is " +
lastName);
}
}