java代码问题
大佬们,为啥这个也会显示数组下标越界啊,该怎么修改啊,好烦!!!!,跪谢大佬帮忙源代码:
package 杨辉三角;
import java.util.Random;
public class card {
private String kind[]= new String[]{"A","K","Q","J","10","9","8","7","6","5","4","3","2"};
private String value[]= new String[]{"黑桃","红桃","梅花","方块"};
public static card a=new card();
public static void main(String[] args) {
// TODO Auto-generated method stub
a.getValue();
a.getKind();
a.toString();
}
StringgetValue() {
System.out.println(kind);
return kind;
}
String getKind() {
System.out.println(value);
return value;
}
void toSring() {
String b=a.getValue();
String c=a.getKind();
System.out.println("b+c");
}
}
因为23行你用的kind.length,而value哪有这么大 getValue()应该是
value
getKind()应该是
kind
叙白 发表于 2020-10-18 12:03
因为23行你用的kind.length,而value哪有这么大
啊啊啊,哥哥,谢谢谢谢 叙白 发表于 2020-10-18 12:08
getValue()应该是
getKind()应该是
老哥,谢谢谢谢
页:
[1]