También he intentado modificarlo un poco declarando la array notas dentro del primer bucle, cuando relleno los datos y cambiando la forma de printarlos, así:
Código JAVA:
Ver originalpackage exercicis.part5;
import java.util.Scanner;
public class ProvaAlumne3 {
public static void main
(String[] args
) {
Alumne2 [] clase=new Alumne2 [2];
Scanner entrada
=new Scanner
(System.
in);
int curs;
for (int posicio=0;posicio<clase.length;posicio++) {
nom=entrada.next();
cognoms=entrada.next();
curs=entrada.nextInt();
int[] notes = new int[6];
for (int posicioNotes=0;posicioNotes<notes.length;posicioNotes++) {
int nota=posicioNotes+1;
System.
out.
print("Introdueix la nota (" +nota
+"):"); notes[posicioNotes]=entrada.nextInt();
}
clase[posicio]=new Alumne2(nom, cognoms, curs, notes);
}
for (int posicio = 0; posicio < clase.length; posicio++) {
System.
out.
println("\n\nL'alumne " + clase
[posicio
].
nom + " " + clase
[posicio
].
cognoms); System.
out.
println("del curs " + clase
[posicio
].
curs); System.
out.
println("Te les seguents notes: "); for (int posicioNotes = 0; posicioNotes < clase[posicio].notes.length; posicioNotes++) {
System.
out.
print(" " + clase
[posicio
].
notes[posicioNotes
]);
}
}
}
}