I am learning to use the functional programming of java 8 and I do not know why but I can not make the code work for me. The problem I have is that everything is fine until I want to assign 2 variables of the class, I can one, but when trying to do the second peta the program. Does anyone know how I can do it?
class Camello{
private String nombre;
private Boolean soborno;
private Boolean libertad;
private int h;
public Camello(String nombre) {
this.nombre=nombre;
}
public static Camello parir(String nombre) {
return new Camello(nombre);
}
public void venderHierva(int kilos) {
System.out.println("Su camello le ha vendido "+kilos+" de maria");
this.h=kilos;
}
public void sobornar(boolean soborno) {
this.soborno=soborno;
}
}
public class Pruebas {
public static void main(String[] args) {
Camello.parir("Gustabo")
.venderHierva(100)
.sobornar(true); //Aqui da error, me dice que no puedo asignar
//Datos con el tipo primitivo booleano
}
}