First of all let me congratulate you on the amazing indentation technique you follow. I think very few programmers in the world survive today who use your indentation technique ... complete left alignment :P.
I suggest you first learn to indent your code. As long as you are doing these kiddy programs you will not have any problems, but when you start writing code even extending to a couple of hundred lines, you will find yourself completely lost trying to figure out which {
belongs to which }
or where an if
block ends etc.
I think you should seriously follow at least some of the coding conventions mentioned by Sun here while programming in Java.
And please give meaningful names to your variables, the sooner you develop these good habits the better it is for your future programmer self.
Now lets see where the problem is :-
System.out.print("\nPlease insert the first card row and column seperated by a comma.");
r1=Integer.parseInt(a.readLine());
Now here you are asking a User to input a row and column number separated by a comma.
But whatever you receive you are directly passing to the Integer.parseInt()
method.
Now let me tell you how exactly readLine()
works, From your code I get the impression that you think the readLine()
method reads character by character which is wrong it actually returns to you the entire LINE of text which was written, so in your case it would be something …