Hello, I'm creating a very simple game.
Here's my code so far
but when I run it and enter say.. "warrior"
It doesn't print anything, it simply stops working.
Here's my code so far
import java.util.Scanner;
public class Quest {
public static void main(String[] args){
System.out.println("You have been summoned to participate in a fighting tournament");
System.out.println("There are 3 classes available: Warrior, Mage and Archer");
System.out.print("Choose your class ");
Scanner ui = new Scanner(System.in);
String input =ui.nextLine();
if(ui.equals("warrior"))
{
System.out.println("You are a mighty warrior, your inventory consists of: blade, shield and chainmail armour");
}
if(ui.equals("mage"))
{
System.out.println("You are a wise mage, your inventory consists of: staff, magic potion and wizard robes");
}
if(ui.equals("archer"))
{
System.out.println("You are a cunning wizard, your inventory consists of: bow and arrow, throwing knives and climbing rope");
}
}
}
but when I run it and enter say.. "warrior"
It doesn't print anything, it simply stops working.