Question for you guys, what am I doing wrong here? I am able to enter the 5 digits in one input and I just want it to display the first character; just to test to see if it works. Afterwards I will be displaying all 5 characters like "1 2 3 4 5" spaced out between each digits...
Error: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 50
at java.lang.String.charAt(Unknown Source)
at PracticeArithmeticOperators.main(PracticeArithmeticOperators.java:12)
import javax.swing.JOptionPane;
public class PracticeArithmeticOperators
{
public static void main(String[] args)
{
String input;
int input1;
input = JOptionPane.showInputDialog(null, "Enter the five digits: ");
input1 = Integer.parseInt(input);
input.charAt(input.charAt(0));
}
}