for (int i = 0; i < 1000; i++) {
//Statement
int count = 0;
if (ResultABinary.equals(ResultBBinary)) {
count++;
System.out.println(count);
}
// System.out.println(count);
}
在此代码中,我得到的计数为1 1 1,如果我打印出注释计数,则得到997乘以0,我该怎么做,我的println为3?简而言之,我想计算语句返回true并打印出该数字的次数
答案 0 :(得分:0)
static int count = 0;
for (int i = 0; i < 1000; i++) {
//Statement
if (ResultABinary.equals(ResultBBinary)) {
count++;
System.out.println(count);
}
}
System.out.println(count);
答案 1 :(得分:0)
int count = 0;
for (int i = 0; i < 1000; i++) {
//Statement
if (ResultABinary.equals(ResultBBinary)) {
count++;
System.out.println(count);
}
}
System.out.println(count);