Im getting this error, however Im not entirely sure why, I did declare(line 6) and initialize(line 11) the variable, yet I still get the error. the code is as follows:
public static char ReadChar (String prompt, boolean gui) {
// Enter (prompt, True) for gui popup, else enter prompt and false
// set up data and objects
Scanner input = new Scanner(System.in);
char data;
String dataGui, strData;
// prompt for an input int value
if (gui == true){
dataGui = JOptionPane.showInputDialog(null, prompt);
data = dataGui.charAt(0);
}
else {
System.out.print(prompt);
strData = input.nextLine();
}
return data;
}