Java Basic: Insert data in separate Class
<p>How to insert data in separate class?</p>

<pre><code>package teste01classes;

public class Teste01Classes {

    public static void main(String[] args) {
        Alunos[] aluno = new Alunos[20];
        aluno[0] = new Alunos();
        aluno[0].nome = "Abel";
        aluno[0].n1 = 10;
        aluno[0].n2 = 7;
        aluno[0].n3 = 8;

        aluno[1] = new Alunos();
        aluno[1].nome = "Ana Carolina";
        aluno[1].n1 = 8;
        aluno[1].n2 = 7;
        aluno[1].n3 = 5;
        //... n alunos
    }
}


package teste01classes;

public class Alunos {
    String nome;
    int n1, n2, n3;
}
</code></pre>

<p>But i need</p>

<pre><code>    Alunos[] aluno = new Alunos[20];
    aluno[0] = new Alunos();
    aluno[0].nome = "Abel";
    aluno[0].n1 = 10;
    aluno[0].n2 = 7;
    aluno[0].n3 = 8;

    aluno[1] = new Alunos();
    aluno[1].nome = "Ana Carolina";
    aluno[1].n1 = 8;
    aluno[1].n2 = 7;
    aluno[1].n3 = 5;
    //... n alunos
</code></pre>

<p>In separated class and invoke in main.</p>
