相关疑难解决方法(0)

Java for循环多个变量

我不确定为什么我的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);
Run Code Online (Sandbox Code Playgroud)

java

6
推荐指数
4
解决办法
10万
查看次数

标签 统计

java ×1