-1
我试图比较功能。每个函数都有这个:return returnArr.toString();作为回报,它们都是字符串。我的比较似乎是错误的
if (moveRight() == paintFood(235,10,"blue")){
alert("Food!")
};
但它是不一样的像这样的:
if ("A" == "A"){
alert("Right comparison");
};
为什么???
向我们展示这两种方法的代码。 – csmckelvey
使用“.equals()”函数。 参见此:http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java – mfruizs2
不健全的优越感,但(一致)[缩进](些许的HTTPS ://en.wikipedia.org/wiki/Indent_style)不会误入歧途。 – Jubobs