I am very new to java programming and need help!
I am having difficulty outputting results from instructions shown:
Write a Java program using Java, that takes an input of a name in the form lastName,firstName and outputs the name in the form firstName lastName.
Both the input and output must use the JOptionPane.
I am using jGrasp. I think it has something to do with .indexOf(str) format to string the results of firstName lastName. Driving me crazy.... Please help!!!
This is what I have so far:
import javax.swing.JOptionPane;
public class NameTags
{
public static void main(String[] args)
{
String name;
String str1;
String str2;
int index;
str1 = "First Name";
str2 = "Last Name";
name = JOptionPane.showInputDialog(" Last name,First name: ");
String title = "Name Tags";
String answer = str1 + str2;
JOptionPane.showMessageDialog(null, answer, title, JOptionPane.INFORMATION_MESSAGE);
}
}