public void thisisnotworking()
{
Scanner input=new Scanner(System.in);
String cardA;
String cardB;
System.out.print(\"Enter Card: \"); cardA=input.nextLi
It's hard to say without seeing game, but seems like cardA and cardB are not in game, so game.indexOf(cardA) returns -1 and game.get(-1) throws the exception.
Also, looking at your code, you search for String in game, and then takes an element from game, which is a String and assigns it to a Card object. You cannot cast from String to any other class than Object, since String is a final class.