We have a school project where we are creating a text-based Black Jack game. I have created different classes like BlackJackDeck, Card, Hand, Player, and Dealer. My Teacher wants us to have a class called BlackJack were the game logic will be. I tried to make a main method inside BlackJack and added a reference to shuffle my BlackJackDeck deck. But it says that "non-static variable length leken cannot be referenced from a static context". If I don't have a main method my program won't be able to run. Here is my code:
package blackjack;
import java.util.ArrayList;
/**
* @version 1.0
* @author robert.englund
*/
public class BlackJack {
ArrayList<Spelare> spelare = new ArrayList<>(); //List with players
BlackJackKortlek leken = new BlackJackKortlek(4); //BlackJackDeck
Dealer dealer = new Dealer(); //The dealer
public static void main(String[] args) {
leken.blanda(); //Shuffle deck
}
}
How should I do it so that I can make the game runnable so that I can write the game logic? Thanks in advance!