Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Livro {
- private String titulo;
- private String autor;
- private int anoLancamento;
- private String isbn;
- public Livro(String titulo, String autor, int anoLancamento, String isbn) {
- this.titulo = titulo;
- this.autor = autor;
- this.anoLancamento = anoLancamento;
- this.isbn = isbn;
- }
- public String getTitulo() {
- return titulo;
- }
- public void setTitulo(String titulo) {
- this.titulo = titulo;
- }
- public String getAutor() {
- return autor;
- }
- public void setAutor(String autor) {
- this.autor = autor;
- }
- public int getAnoLancamento() {
- return anoLancamento;
- }
- public void setAnoLancamento(int anoLancamento) {
- this.anoLancamento = anoLancamento;
- }
- public String getIsbn() {
- return isbn;
- }
- public String toString(){
- return titulo + " (ISBN " + isbn + "), " + anoLancamento + "." + System.lineSeparator() + autor;
- }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((isbn == null) ? 0 : isbn.hashCode());
- return result;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Livro other = (Livro) obj;
- if (isbn == null) {
- if (other.isbn != null)
- return false;
- } else if (!isbn.equals(other.isbn))
- return false;
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement