Galera, estou com o seguinte problema, estou querendo receber por parâmetro um array de strings contando numeros aleatorios, fiz uns testes dentro do método e o array é inicializado direitinho, o problema é quando eu tento retornar esse array, ele volta como null, da mesma forma que estava antes quando inicializado null, e se eu não inicializo o array como null no main, ele nem vai pro método. O que estou fazendo de errado ? Obrigado !
import java.io.*;
import java.util.Random;
public class trabalho {
public static void main(String args[]){
String NUMEROSGERADOS[] = null;
int CONT;
GERAFORMULARIO(NUMEROSGERADOS);
try{
FileWriter ARQUIVO = new FileWriter(“teste.txt”);
BufferedWriter BUFFER = new BufferedWriter(ARQUIVO);
for (CONT = 0; CONT < NUMEROSGERADOS.length; CONT++){
BUFFER.write(NUMEROSGERADOS[CONT]);
BUFFER.newLine();
}
BUFFER.close();
}catch (IOException ioe){
System.out.println("Erro: " + ioe.toString());
}
}
public static String[] GERAFORMULARIO(String [] [b]GERA_ARRAYALEATORIO[/b]){
String AUX;
int ALEATORIO,CONT;
Random GENERATOR = new Random();
GERA_ARRAYALEATORIO = new String[50];
for (CONT = 0; CONT < 50; CONT++){
ALEATORIO = GENERATOR.nextInt();
AUX = String.valueOf(ALEATORIO);
GERA_ARRAYALEATORIO[CONT] = AUX;
}
return [b]GERA_ARRAYALEATORIO[/b];
}
}
