Correction exercice 3

import java.util.LinkedList;
/** 
 * Une section dispose d'un numéro et d'un titre et est composé d'un
 * ensemble de paragraphes. Elle offre l'accès à son titre, l'ajout d'un
 * paragraphe et son affichage
 */
public class Section {
    private String title;
    private LinkedList<Paragraph> paragraphs;

    /** un constructeur prenant comme paramètre le titre de la section
     *  @param title le titre de la section
     */
    public Section(String theTitle) {
        this.title=theTitle;
        this.paragraphs = new LinkedList<Paragraph>();
    }
    /** rend le titre de la section */
    public String getTitle(){
        return this.title;
    }
    /** ajoute le paragraphe en paramètre aux paragraphes de la
     *  section
     */
    public void addParagraph(Paragraph paragraph){
        this.paragraphs.add(paragraph);
    }
    /** rend une chaîne de caractères qui décrit la section (son
     *  numéro, son titre suivi des paragraphes)
     */
    public String toString(){
        String res = this.title+"\n";
        for(Paragraph p : this.paragraphs)
            res += "\t"+p+"\n";
        return res;
    }
    public static void main(String[] arg){
        Section sec1 = new Section("sec1");
        Section sec2 = new Section("sec2");
        Section sec3 = new Section("sec3");

        sec1.addParagraph(new Paragraph("le texte1"));
        System.out.println("Section 1 : "+ sec1);
        sec1.addParagraph(new Paragraph("le texte2"));
        System.out.println("Section 1 : "+ sec1);
        sec1.addParagraph(new Paragraph("le texte3"));
        System.out.println("Section 1 : "+ sec1);
        sec2.addParagraph(new Paragraph("le texte4"));
        System.out.println("Section 2 : "+ sec2);
        sec3.addParagraph(new Paragraph("le texte5"));
        System.out.println("Section 3 : "+ sec3);
        sec2.addParagraph(new Paragraph("le texte 4 bis"));
        System.out.println("Section 2 : "+ sec2);
    }
}