w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
War card game Crashes on start

One way you can check to see if all your information is doing okay, is to have it print to the console while your program is running. For example, before you have your card display, you can do:

System.out.println(//information that you want to check);

This is a very simple and especially very effective form of debugging so that you can figure out if your code is working or not

Another issue, which I see has been addressed before, is:

String [] suits = {"Heart" + "Diamond" + "Spade" + "Club"};
String [] numbers = { "2" + "3" + "4" + "5" + "6" + "7" + "8" + "9" + "10"
+ "Jack" + "Queen" + "King" + "Ace" };

These need to be , instead

String [] suits = {"Heart" , "Diamond" , "Spade" , "Club"};
String [] numbers = { "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "10"
, "Jack", "Queen" , "King" , "Ace" };

Using + in a string fashion such as "Heart" + "Diamond" is what is known as concatenating, or joining the two strings together.

Hope it helps





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.