[英]Trouble printing a for loop in a page
I'm currently trying to print the result of a for loop located in a servlet onto a web page, however, for some reason, despite the for being correctly structured, it is only printing the first instance/result.我目前正在尝试将位于 servlet 中的 for 循环的结果打印到 web 页面上,但是,由于某种原因,尽管结构正确,但它只打印第一个实例/结果。
private int[] tabla (String Numero){
int[] resultado = new int [12];
for(int i = 0; i <= resultado.length; i++)
{
resultado[i]=Integer.parseInt(Numero)*i;
}
return resultado;
}
What am I doing wrong?我究竟做错了什么? Is the for being interrupted for some reason?是因为某种原因被打断了吗?
Remove the = from the for loop for(int i = 0; i < resultado.length; i++)从 for 循环中删除 = for(int i = 0; i < resultado.length; i++)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.