Erro quando compilo

5 respostas
faicoxim

C:\java\qweqwe.java:9: cannot resolve symbol
symbol : variable lenght
location: class java.lang.String[]
int oneLenght = wordlistone.lenght;
^
C:\java\qweqwe.java:10: cannot resolve symbol
symbol : variable lenght
location: class java.lang.String[]
int twoLenght = wordlisttwo.lenght;
^
C:\java\qweqwe.java:11: cannot resolve symbol
symbol : variable lenght
location: class java.lang.String[]
int threeLenght = wordlistthree.lenght;
^
3 errors

Process completed.

public class phraseomatic
{
	public static void main (String args[])
	{
		String[] wordlistone = {"julio","andersonnnn","coelho"};
		String[] wordlisttwo = {"anderson","oliveira","cachorro"};
		String[] wordlistthree = {"roxo","ronaldo","zanata"};
		
		int oneLenght = wordlistone.lenght;
		int twoLenght = wordlisttwo.lenght;
		int threeLenght = wordlistthree.lenght;
		
		int rand1 = (int) (Math.random() * oneLenght);
		int rand2 = (int) (Math.random() * twoLenght);
		int rand3 = (int) (Math.random() * threeLenght);
		
		String phrase = wordlistone[rand1] + "" + wordlisttwo[rand2] + "" + wordlistthree[rand3];
		System.out.println("Precisamos de"+ phrase);
	}
}

5 Respostas

A

Amigo,

Troca wordlistone.lenght por wordlistone.length, e nos demais array também.

Arthur

A
faicoxim:
C:\java\qweqwe.java:9: cannot resolve symbol symbol : variable lenght location: class java.lang.String[] int oneLenght = wordlistone.lenght; ^ C:\java\qweqwe.java:10: cannot resolve symbol symbol : variable lenght location: class java.lang.String[] int twoLenght = wordlisttwo.lenght; ^ C:\java\qweqwe.java:11: cannot resolve symbol symbol : variable lenght location: class java.lang.String[] int threeLenght = wordlistthree.lenght; ^ 3 errors

Process completed.

public class phraseomatic
{
	public static void main (String args[])
	{
		String[] wordlistone = {"julio","andersonnnn","coelho"};
		String[] wordlisttwo = {"anderson","oliveira","cachorro"};
		String[] wordlistthree = {"roxo","ronaldo","zanata"};
		
		int oneLenght = wordlistone.lenght;
		int twoLenght = wordlisttwo.lenght;
		int threeLenght = wordlistthree.lenght;
		
		int rand1 = (int) (Math.random() * oneLenght);
		int rand2 = (int) (Math.random() * twoLenght);
		int rand3 = (int) (Math.random() * threeLenght);
		
		String phrase = wordlistone[rand1] + "" + wordlisttwo[rand2] + "" + wordlistthree[rand3];
		System.out.println("Precisamos de"+ phrase);
	}
}

Por que você num utiliza um IDE (eclipse ou netbeans) vai te ajudar bastante.

T
agcn84:
faicoxim:
C:\java\qweqwe.java:9: cannot resolve symbol symbol : variable lenght location: class java.lang.String[] int oneLenght = wordlistone.lenght; ^ C:\java\qweqwe.java:10: cannot resolve symbol symbol : variable lenght location: class java.lang.String[] int twoLenght = wordlisttwo.lenght; ^ C:\java\qweqwe.java:11: cannot resolve symbol symbol : variable lenght location: class java.lang.String[] int threeLenght = wordlistthree.lenght; ^ 3 errors

Process completed.

public class phraseomatic
{
	public static void main (String args[])
	{
		String[] wordlistone = {"julio","andersonnnn","coelho"};
		String[] wordlisttwo = {"anderson","oliveira","cachorro"};
		String[] wordlistthree = {"roxo","ronaldo","zanata"};
		
		int oneLenght = wordlistone.lenght;
		int twoLenght = wordlisttwo.lenght;
		int threeLenght = wordlistthree.lenght;
		
		int rand1 = (int) (Math.random() * oneLenght);
		int rand2 = (int) (Math.random() * twoLenght);
		int rand3 = (int) (Math.random() * threeLenght);
		
		String phrase = wordlistone[rand1] + "" + wordlisttwo[rand2] + "" + wordlistthree[rand3];
		System.out.println("Precisamos de"+ phrase);
	}
}

Por que você num utiliza um IDE (eclipse ou netbeans) vai te ajudar bastante.

Discordo, se o cara ta começando o melhor é ele não utilizar IDE, já tive esse mesmo problema uma vez trocando as letras "T" e "H".....

tspaulino

Concordo plenamente!!!

O uso de IDE’s para quem está iniciando o estudo da linguagem leva ao comodismo…
Bloco de notas nele!!! Vai aprender a fazer na unha, pra depois pegar as manhas de IDE’s… é bem melhor do que passar raiva vendo aquele tanto de classe e código que o NetBeans cria e você nem sabe pra que serve…

Notepad++: the best IDE!!!
hauhauhauahuahauhauah

Abraço,

Tiago Paulino

faicoxim

Aí pessoal muito obrigado, funcionou

Criado 22 de setembro de 2008
Ultima resposta 22 de set. de 2008
Respostas 5
Participantes 4