I have a card class:
public class Card{
private final Rank rank;
public Rank rank() { return rank; }
public Card(Rank rank) {
this.rank = rank;
}
}
Where Rank is an enum defined as so:
enum Rank {
TWO ("2"),
THREE ("3"),
FOUR ("4"),
private final String rankNum;
private Rank(String rankNum) { this.rankNum = rankNum; }
public String rankNum(){ return rankNum; }
}
So my goal is to input a string "2" as a command line argument and then make a new card object with its rank value as TWO. If the input were "TWO" then it would be possible to do this but I do not know how to do it if the input is "2".
If the input were "TWO" I would do the following:
Card firstCard = new Card(Rank.args[0]);
I hope this question wasn't too badly phrased or obvious, as you can tell I'm still in my early stages, but I've searched this question for hours to no avail.