0
I am beginner in java, and I am creating a basic CRUD of a library, as I have many operations, I thought better to make a specialized class for each operation, which will call the methods of the library class. I am doing the registration operation class, where it will call the methods registerAuthor, register, register.
but I don’t know what to call the methods, because they are in a different class.
follows the code:
Library class
public void cadastarAutor(Autor autor) {
this.autores.add(autor);
}
public void cadastrarEditora(Editora editora) {
this.editora.add(editora);
}
public void cadastrarLivro(Livro livro) {
this.livro.add(livro);
}
Class Cadastrar
import RepositorioLivros.Biblioteca;
public class Cadastrar {
Biblioteca biblioteca= new Biblioteca();
biblioteca.
}
how do I call the library class methods to use in the Register class? , I set up a library in the register class and have tried to do so: library. and call the methods, but when I try to call ñ works, the Eclipse doesn’t even show the options after the .(dot)
The correct one would be when I tried to call, appear the options of the methods that are in the library class, but Ñ appears, after I type library. , he makes a mistake:
What happens when you try to call?
– Maniero
I edited and put the bug image in my question, update and review
– italo vinicius
import RepositorioLivros.Biblioteca;
: has a package calledRepositorioLivros
?– igventurelli
yes Igor Venturelli has yes
– italo vinicius
Registration is to be a class or a method?
– Don't Panic
Which package to class
Cadastrar
is?– igventurelli
Edit the question including the complete code of the two classes, please. From the first line of the file to the last
– igventurelli
As I said, I made a separate class for each operation, the operation class will only handle the operations of registering, but the operations are in the Library class, and I want to call them to the Register class.... The Register class is in a package called Operations
– italo vinicius