public class Episodio { private int numero; private String tipo; private Date fechaInicio; private Date fechaFinal; public Episodio(int numero, String tipo, Date fechaInicio){ this.numero = numero; this.tipo = tipo; this.fechaInicio = fechaInicio; } public int getNumero() { return numero; } public void setNumero(int numero) { this.numero = numero; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public Date getFechaInicio() { return fechaInicio; } public void setFechaInicio(Date fechaInicio) { this.fechaInicio = fechaInicio; } public Date getFechaFinal() { return fechaFinal; } public void setFechaFinal(Date fechaFinal) { this.fechaFinal = fechaFinal; int horas=(int) Math.floor(((this.fechaFinal.getTime()- this.fechaInicio.getTime())/3600000)); if(horas > 12) this.setTipo("HOS"); } } // Y donde usariamos la clase Episodio delegaríamos la lógica del comportamiento // del episodio al objeto episodio. SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd H:m:s"); Date fechaInicial=dateFormat.parse("2019-02-10 10:00:00"); Episodio e = new Episodio(12345,"CMA",fechaInicial); Date fechaFinal=dateFormat.parse("2019-02-11 11:00:00"); e.setFechaFinal(fechaFinal); // Y nada más.