Java for 循环 多个变量 [已关闭]
2022-09-05 00:05:40
我不确定为什么我的Java代码无法编译,任何建议都将不胜感激。
String rank = card.substring(0,1);
String suit = card.substring(1);
String cards = "A23456789TJQKDHSCl";
String[] name = {"Ace","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Jack","Queen","King","Diamonds","Hearts","Spades","Clubs"};
String c ="";
for(int a = 0, b = 1; a<cards.length-1; b=a+1; a++;){
if(rank===cards.substring(a,b){
c+=name[a];
}
}
system.out.println(c);