Blackjack program returning cards as null?
<p>Main Class:</p>

<p>public class Blackjack {</p>

<pre><code>static Deck D;
static Hand P;
public static void main(String[] args) {
    init();
}

private static void init() {
    D=new Deck();
    P=new Hand(D);
    startGame();
}

private static void startGame() {
    System.out.print("Your cards are: "+P.H.get(0)+", "+P.H.get(1));
}
</code></pre>

<p>}</p>

<p>Hand Class:</p>

<pre><code>import java.util.ArrayList;
import java.util.Random;


public class Hand {
ArrayList&lt;String&gt; H;
Random R;
public Hand(Deck D){
    R=new Random();
    H=new ArrayList&lt;String&gt;();
    int C=R.nextInt(D.getP().length);
    H.add(D.getP()[C]);
    D.removeFromDeck(C);
    int E=R.nextInt(D.getP().length);
    H.add(D.getP()[E]);
    D.removeFromDeck(E);
}
</code></pre>

<p>}</p>

<p>Deck Class</p>

<pre><code>public class Deck {
String[] P;
public Deck(){
    P=new String[52];
    String Suit="Default";
    int C=0;
    for(int A=1;A&lt;=4;A++){
        switch(A){
        case 1:
            Suit="Hearts";
            break;
        case 2:
            Suit="Diamonds";
            break;
        case 3:
            Suit="Clubs";
            break;
        case 4:
            Suit="Spades";
            break;
        }
        for(int B=1;B&lt;=13;B++){
            if(B&gt;10){
                switch(B){
                case 11: P[C]="Joker of "+Suit; 
                break;
                case 12: P[C]="Queen of "+Suit;
                break;
                case 13: P[C]="King of "+Suit;
                break;
                }
            }else{
                P[C]=B+" of "+Suit;
            }
        }
    }
}
public void setP(String[] p) {
    P = p;
}
public String[] getP() {
    return P;
}
public void removeFromDeck(int C){
    System.arraycopy(P, C + 1, P, C,
            P.length - C - 1);
}
</code></pre>

<p>}</p>

<p>When I compile and run this code, it prints that my 2 cards are null, null. I have looked through the code and can't seem to find my error. Maybe you can? TY for any help you give me.</p>

<p>Edit: It is now returning spades only, could someone please help?</p>
