Démonstration d’une boucle avec while

Author:


{filelink=4627}

public class WhileDemo {
    public static void main(String[] args) {

        String meCopier = "Copier ce text jusqu'� ce que vous trouvez la lettre v";
        StringBuffer copierDansMoi= new StringBuffer();

        int i = 0;
        char c = meCopier.charAt(i);

        while (c != 'v') {
            copierDansMoi.append(c);
            c = meCopier.charAt(++i);
        }
        System.out.println(copierDansMoi);
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *