public void thisisnotworking()
{
Scanner input=new Scanner(System.in);
String cardA;
String cardB;
System.out.print(\"Enter Card: \"); cardA=input.nextLi
Try this...
public void thisshouldwork()
{
Scanner input=new Scanner(System.in);
String cardA;
String cardB;
System.out.print("Enter Card: "); cardA=input.nextLine();
System.out.print("Enter Card "); cardB=input.nextLine();
game.add(cardA);
game.add(cardB);
Card a = game.get(game.indexOf(cardA));
Card b = game.get(game.indexOf(cardB));
The problem is you aren't adding cardA or cardB to game so indexOf
returns -1 and get
throws an IndexOutOfBounds Exception