logo

Crowdly

Dadas las siguientes clases: public class Libro { private String name ; ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Dadas las siguientes clases:

public class Libro {

private String name ;

private boolean prestado;

public Libro (String name, boolean prestado) {

this.name = name;

this.prestado = prestado;

}

public Libro (Libro libro) {

this.name = libro.name;

}

public String toString () {

return this.name + ":" + this.prestado;

}

public boolean esIgual (Libro libro) {

return this.name.equals(libro.name) &&

this.prestado == libro.prestado;

}

}

public class Prueba {

public static void main (String [] args) {

Libro libro1 = new Libro("Cocina japonesa", true);

Libro libro2 = new Libro(libro1) ;

System.out.println(libro1 + "**" + libro2 + "**" + libro1.esIgual(libro2));

}

}

Escribe la salida en consola al ejecutarlo:

More questions like this

Want instant access to all verified answers on moodle.upm.es?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!