【发布时间】:2014-09-30 23:55:12
【问题描述】:
我正在学习编程,我正在研究数组,但是在这个方法(它在一个类中)中,由于某种原因,当它编译时它向我显示“错误:令牌上的语法错误,错误的构造( s)”消息。
这是代码:
public int[] ByN(int[] vector){
int Blancas = 0;
int Negras = 0;
int[] ByN = new int[2];
combinacion temporal = new combinacion(tamlog);
temporal.copiar(vec);
for (int i = 0; i < tamfisico; i++){
int j = 0;
Boolean Tof=false;
While ((ToF == false) && (j < tamfisico);){
if (vector[i] == temporal[j]){
Blancas ++;
temporal.borrar(j);
j--;
t--;
ToF= true;
}
j++;
}
}
for (int i = 0; i < tamlog; i++){
if (vec[i]== vector[i])
Negras++;
}
Blancas = Blancas - Negras;
ByN[0]= Blancas;
ByN[1] = Negras;
return ByN;
}
这意味着考虑 2 个 int 数组并计算两个数组中有多少 - 有多少在完全相同的位置。
问题似乎出在第一个不知道为什么...
【问题讨论】: