I'm working on Java project - Playing Cards.
And, in this Card.java class, I've declared and initialized variables and array list. I've come across this error. These errors are under each getter and setter methods.
error: incompatible types: String cannot be converted to String[]
error: incompatible types: int[] cannot be converted to int
public class Card {
// private String suit;
//private String name;
//private int value;
private String[] suit = {"spades","hearts","clubs","diamonds"};
private String[] name = {"Ace","Jack","Queen","King"};
private int[] value = {1,2,3,4,5,6,7,8,9,10,11,12,13};
public Card(String s, String n, int v)
{
suit = s;
name = n;
value = v;
}
public String getSuit()
{
return suit;
}
public String getName()
{
return name;
}
public int getValue()
{
return value;
}
public String toString()
{
return "<"+suit+" "+name+">";
}
This is the whole class.
Hope anyone knows and can help me out, thanks! (:
If you don't understand what i'm trying to get at, let me know, try my best to explain
suit? What are you trying to assign to it? Similarly forvalue.int[]andintare not same