xandevieira 18 de fev. de 2011
vc esta fechando as chaves no lugar errado.
public class Celular {
public int numcel = 86544499 ;
public int chamNaten = 0 ;
public long numeros [] = { 83838829 , 9838383 , 383833 , 383838 , 3838338 };
public void acharnumero ( int x ) {
for ( int i = 0 ; i <= 5 ; i ++ ) {
if ( x == i ) {
System . out . println ( + numeros [ i ] );
}
}
}
public void imprimanatela () {
for ( int i = 0 ; i <= 5 ; i ++ ) {
System . out . println ( + numeros [ i ] );
}
}
}
de qq forma, tem problema na logica, tente fazer, qq coisa poste suas dúvidas
obs. Sempre utilize as tags code na postagem de código
dxrodrigues 18 de fev. de 2011
Deveria testar antes, e eler as mensagens de erro para tentar descobrir o que está dando errado, o código com as correções ficaria assim:
public class Celular {
public int numcel = 86544499 ;
public int chamNaten = 0 ;
public long numeros [] = { 83838829 , 9838383 , 383833 , 383838 , 3838338 };
public void acharnumero ( int x ) {
for ( int i = 0 ; i < numeros . length ; i ++ ) {
if ( x == i ) {
System . out . println ( numeros [ i ] );
}
}
}
public void imprimanatela () {
for ( int i = 0 ; i < numeros . length ; i ++ ) {
System . out . println ( numeros [ i ] );
}
}
public static void main ( String [] args ) {
Celular c = new Celular ();
c . acharnumero ( 1 );
c . imprimanatela ();
}
}
leia e tente entender as alterações.
Abs.
tiagoheleno 18 de fev. de 2011