So I have my program, and it just won't run after the last question (which needs input). My code is here:
import java.util.Scanner;
import javax.swing.JOptionPane;
public class HiConor
{
public static void main(String[] args)
{
String result;
int selection;
int Entry;
boolean isYes;
System.out.print("Starting Program");
System.out.print(".");
System.out.print("");
System.out.print(".");
System.out.print("");
System.out.print(".");
System.out.print("");
System.out.print(".");
JOptionPane.showMessageDialog(null, "Hello there!");
selection = JOptionPane.showConfirmDialog(null, "Are you doing good?");
boolean isNo;
boolean isCancel;
isNo = (selection == JOptionPane.NO_OPTION);
isYes = (selection == JOptionPane.YES_OPTION);
isCancel = (selection == JOptionPane.CANCEL_OPTION);
if(isYes){
JOptionPane.showMessageDialog(null, "Yes?" + " That's nice to hear!");
}
if(isNo){
JOptionPane.showMessageDialog(null, "No?" + " Well then, cheer up!");
}
if(isCancel){
JOptionPane.showMessageDialog(null, "Fine then, don't respond");
}
Scanner keyBoard = new Scanner(System.in);
Scanner input = new Scanner(System.in);
JOptionPane.showInputDialog(null, "What is your name?",
"Mlg recess poofs",
JOptionPane.ERROR_MESSAGE);
String userinput = input.next();
if(userinput.equals("alex")){
JOptionPane.showMessageDialog(null, "What a lovely name!");
}
JOptionPane.showMessageDialog(null, "I have a feeling you're trolling me " + ". This is the end of the program. Goodbye.");
}}
Change it to this
String userinput = JOptionPane.showInputDialog(null, "What is your name?",
"Mlg recess poofs",
JOptionPane.ERROR_MESSAGE);
Remove:
Scanner input = new Scanner(System.in);
String userinput = input.next();