埃罗Java中,无法找到符号 [英] erro java, cannot find symbol
本文介绍了埃罗Java中,无法找到符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
唉,我这是新,我不知道我可以使这个程序工作,我需要写一个计算并返回一个向量的分量之和的平方程序
well, i'm new in this and i dont know how i can make this program works, i need Write a program that calculates and returns the sum of the components of a vector squared
和我得到这个错误:
import java.util.*;
public class cuadrado
{
public static void main(String[] args)
{
Scanner teclado= new Scanner (System.in);
int n=0,i=0,y=0;
System.out.println("ingrese el valor de el vector");
n=teclado.nextInt();
int[ ]suma=new int[n];
for(i=0;i<suma.lenght;i=i+1);
{
System.out.println("ingrese el valor de un numero");
suma[i]=teclado.nextInt();
y+=suma[i];
System.out.println(""+y);
}
}
}
在该行无法找到符号16
cannot find symbol in the line 16
推荐答案
通过在你的循环,你的循环上的空白声明的末尾添加分号之前,你甚至到达您的code座。然后,当你到达code座里面的我,这是不确定的,因为你现在出的for循环的上下文。
By adding the semicolon at the end of your for loop, you're looping on a blank statement before you even reach your code block. Then, when you reach your i inside the code block, it is undefined, because you are now out of the context of the for loop.
这篇关于埃罗Java中,无法找到符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文