Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spoting structures mistakes.
String[][] table = new String[][] { {"Spade","Diamond","Heart","Club"}, {"Ace", "2","3","4","5","6","7","8","9","Jack","Queen","King",} };
String LuckyCard;
for (int r = 0; r < table.length; r++)
{
for (int c = 0; c < table[r].length; c++)
{
int cardLucky = (int)(Math.random()*13) + 1;
int suitLucky = (int)(Math.random()*4) + 1;
LuckyCard = "Lucky Card is " + table[cardLucky][suitLucky];
System.out.println(LuckyCard);
break;
}
}
for(int i = 0; i < table.length; i++) {
for(int j = 0; j < table[i].length; j++) {
System.out.print(table[i][j] + " ");
}
}
}
Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home[
^]
ultraedit[
^]
This code is non sense, you need to explain what you try to do.
table
is not a 2d array of cards, it is a list of 2 lists, the first one is a list of suits and the second is a list of cards values.
So this:
LuckyCard = "Lucky Card is " + table[cardLucky][suitLucky];
must be replaced by:
LuckyCard = "Lucky Card is " + table[1][cardLucky] + table[0][suitLucky];
your code have many other problems, but we need to know what you try to do.