Hi, I'm getting an error that an object cannot be instantiated in the following code
public class Prog2 { /** * @param args the command line arguments */ public static void main(String [] args){ Card card = new Card(Rank.QUEEN, Suit.SPADES); //System.out.println(card); //System.out.println(card.toStringShort()); System.out.println("_____________________________"); /* Deck deck = new Deck(); deck.shuffle(); for (int i = 0; i < 50; ++i) { System.out.println(deck.dealCard()); } System.out.println(deck); //prints the remaining cards System.out.println("_____________________________"); Shoe shoe = new Shoe(4); shoe.shuffle(); for (int i = 0; i < 50; ++i) { System.out.println(shoe.dealCard()); } System.out.println("_____________________________"); */ } } class Card{ //outputs info for a single instance of a card public int SingleCard; public int SingleSuit; public Card(int x, int y) { SingleCard = x; SingleSuit = y; } class Deck{ } class Shoe{ } class Rank{ public static final int ACE=0; public static final int TWO=1; public static final int THREE=2; public static final int FOUR=3; public static final int FIVE=4; public static final int SIX=5; public static final int SEVEN=6; public static final int EIGHT=7; public static final int NINE=8; public static final int TEN=9; public static final int JACK=10; public static final int QUEEN=11; public static final int KING=12; } class Suit{ public static final int SPADES = 1; public static final int HEARTS = 0; public static final int CLUBS = 3; public static final int DIAMONDS = 2; }}
I keep getting this error:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - internal error; cannot instantiate Card(int,int) at prog2.Card to ()
at prog2.Prog2.main(Prog2.java:7)
Java Result: 1
BUILD SUCCESSFUL (total time: 3 seconds)
---
When I tried replacing Rank.QUEEN and Suit.SPADES with integer values instead the program had no problem.