-3
I need to create a program that works like a library. I managed to create a part of the program that creates a book, given the information as parameters. Now I need to create an Arraylist that can store several books, adding and removing using other functions. I’ll send the code to create a book, if anyone can help me, I’d appreciate it.
public class biblioteca {
public class Livro {
private String titulo;
private String autor;
private short ano;
private String codigo;
private boolean disponibilidade;
ArrayList<Livro> livros;
public Livro(String novoTitulo, String novoAutor, short novoAno, String novoCodigo, boolean novaDisponibilidade){
this.titulo = novoTitulo;
this.autor = novoAutor;
this.ano = novoAno;
this.codigo = novoCodigo;
this.disponibilidade = novaDisponibilidade;
}
}
It is strange because it has a list of books within its Book class, probably this one does not compile because this list is not being instantiated also.
– André Martins