Image

Imagemgrjoe wrote in Imagejava_dev

hey guys, I got this class I made... I was wondering what's wrong with it though. It says something is wrong with the userInput.equals() method

as a side note, i'm using SavitchIn.object is for my input.
-- SavitchIn.readLineChar() is for reading in char values

	public int addMail() //adding mail to the box
	{
		System.out.println("Would you like to add mail to" + boxOwner + "'s P.O. Box? (y = yes n = no)");
		char userInput;
		userInput = SavitchIn.readLineChar();

		if (userInput.equalsIgnoreCase('n')){
		System.out.println("You selected 'no' as your answer");
		System.exit(0);
		}else if (userInput.equalsIgnoreCase('y')){
		System.out.println("You selected 'yes' as your answer");
		System.out.println("How much mail would you like to enter?");
		int newMail = SavitchIn.readLineInt();
		numOfMail += newMail;
		}else{
		System.out.println("You entered an invalid key.");
		System.exit(0);
		}
	}