This seemed to make it work

static Scanner input=new Scanner(System.in);

I think it's cause it's outside the main but I'm not sure.

Also please follow what jps has said.