I'm writing a program and I want to access a method from a different class. I know you are supposed to create a new object for the method you want to use, but every time I do that, it states, "The constructor Card() is undefined". I don't want to access the constructor though, I want to access a different method in that class.
Here is the very beginning of my method I want to bring my "other" method in to. I tried creating a new object but it gives me an error on that part that's in between the *__*:
public void addCard(Card[][]card) {
Card card1;
card1 = *new Card();*
The other method is simply called getCard(int r, Suit s)
(this is in a different class). There is also a constructor method in this class and that's what the error seems to be talking about..?
If you could help that would be Great, thanks!
Here's my Card class:
public class Card {
private static Card[][] card = new Card[4][13];
private int rank;
public enum Suit{hearts, diamonds, clubs, spades};
private Suit suit;
private Card(int r, Suit s){
this.suit = s;
this.rank = r;
}
public int getRank(){
return rank;
}
public Suit getSuit(){
return suit;
}
public static Card[][] getCard(int r, Suit s){
if(card == null){
return card;
}
else{
card = new Card[4][13];
return card;
}
}