No, tengo el mismo problema. Adjunto la clase Author:
Código
import java.util.Vector; public class Author{ /** Name of the Author */ /** * Constructor. * @param name Name of the author */ this.name = name; } /** * Gets the name of the Author * @return Name of the author */ return this.name; } }
Adjunto una parte de la clase Main:
Código
public class Main1 { /** * Entry point. * @param args Command-line arguments */ Material m1 = new Material("Object Oriented Programming. Java practices"); Material m2 = new Material("UML cases"); Material m3 = new Material("Introduction to Programming"); Material m4 = new Material("Algebra Theory"); Material m5 = new Material("Graph Theory"); Author a1 = new Author("John Pitt"); Author a2 = new Author("Ella Stallone"); Author a3 = new Author("Josh MacQueen"); Author a4 = new Author("Peter Hoffmann"); Author a5 = new Author("Stella Clooney"); Author a6 = new Author("George Damon"); Author a7 = new Author("Sarah Burton"); // ADD AUTHOR a1 TO MATERIAL m1 m1.addAuthor(a1); // ADD AUTHOR a5 TO MATERIAL m1 m1.addAuthor(a5); // ADD AUTHOR a6 TO MATERIAL m1 m1.addAuthor(a6); // a5 is already author of m1, it should not be added again m1.addAuthor(a5); m2.addAuthor(a1); m3.addAuthor(a2); m3.addAuthor(a7); m4.addAuthor(a2); m4.addAuthor(a4); m4.addAuthor(a3); // Try to add 1 more author than the maximum number of authors a material can have m4.addAuthor(a1);
Y adjunto parte de la clase Material:
Código
public class Material extends Author { /** Maximum number of Authors in any Material */ private static final int MAX_AUTHORS = 3; /** Material Authors */ private Author[] authors; /** Authors number */ private int authorsN; /** Materials Title */ /** * Constructor. * @param title The title of this material */ super(name); this.title = title; this.authorsN = 0; }
Si la clase Material no la modifico y la dejo tal cual está, el compilador dice que no ve la variable name. Si le añado un parametro String name al constructor Material, Eclipse no me compila y me da error en el Main (Material m1 - m5).
Lo que no entiendo es porque si pongo super (title) me compila bien.