public class Periode{ private int nbrjour; private Date n; private Date m; public Periode(Date a, Date b){ this.n=a; this.m=b; this.nbrjour=((b.annee-a.annee)*365)+((b.mois-a.mois)*31)+(b.jour-a.jour); } public String toString(){ return System.out.println("L'intervalle entre "+this.n.toString+" et "+this.m.toString+" est de "+this.nbrjour+"jour(s)"); } public void prolongePeriode(){ this.m=this.m.lendemain; this.nbrjour++; } public int intervalle(){ return this.nbrjour; } public static void main(String[] args) { Date d = new Date(); Date l = d.lendemain(); Periode p = new Periode(d,l); Periode i = new Periode(d,l); i.prolongePeriode(); i.prolongePeriode(); int n = p.intervalle(); p.toString(); i.toString(); System.out.println(p); System.out.println(i); System.out.println(n); } }