我想要这样的事情:
String Aa, Eb, Cc, Dd, Be, Ff = "1";
String Ba, Db, Ac, Ed, Fe, Cf = "2";
String Ea, Cb, Bc, Fd, Ae, Df = "3";
String Da, Ab, Fc, Bd, Ce, Ef = "4";
String Fa, Bb, Ec, Cd, De, Af = "5";
String Ca, Fb, Dc, Ad, Ee, Bf = "6";
但这不起作用,它会产生最后的(Ff,Cf,Df,Ef,Af和Bf),但之前的那些会被忽略。另外,我不想制作数组,因为挑战(我在课堂上)是在不使用任何形式的数组的情况下编程数独。
答案 0 :(得分:1)
您必须初始化每个字符串,如下所示:
String Aa = "1", Eb = "1", Cc = "1", Dd = "1", Be = "1", Ff = "1";
...
另一种选择是:
String Aa, Eb, Cc, Dd, Be, Ff;
Aa = Eb = Cc = Dd = Be = Ff = "1";
...
答案 1 :(得分:0)
数组对您无效,
所以你可以
喜欢
String Aa = "1", Eb = "1"....;
或
String Aa = "1";
String Eb = "1";
...
比java语言中未定义的更灵活