

1.

public class Bonjour {
  public static void main(String[] args) {
    byte b = 1;
    short court = 14;
    int entier = 812;
    long large = 935459761L;
    boolean bool = false;
    char c = 'Z';
    float flottant = 12.5f;
    double virgule = 56.6d;
    System.out.println("byte: " + b);
    System.out.println("short: " + court);
    System.out.println("int: " + entier);
    System.out.println("long: " + large);
    System.out.println("boolean: " + bool);
    System.out.println("char: " + c);
    System.out.println("float: " + flottant);
    System.out.println("double: " + virgule);
  }
}

2.


public class Bonjour {
  public static void main(String[] args) {
    for(int i = 0; i != args.length; i++) {
      System.out.println("Bonjour " + args[i]);
    }
  }
}

3.



public class Bonjour {
  public static void main(String[] args) {
    int somme = 0;
    for(int i = 0; i != args.length; i++) {
      somme += Integer.parseInt(args[i]);
    }
    System.out.println("La somme des nombres en ligne de commande est : " + somme);
  }
}

4.

import java.util.Arrays;

public class Bonjour {
  public static void main(String[] args) {
    int[] tab = new int[args.length];

    for(int i = 0; i != args.length; i++) {
      tab[i] = Integer.parseInt(args[i]);
    }

    Arrays.sort(tab);

    System.out.print("Ordre croissant : ");
    for(int i = 0; i != args.length; i++) {
      System.out.print(" " + tab[i]);
    }
    System.out.println();
  }
}


5.


public class Grille {
	public static void main(String[] args) {
		if (args[0] == "0") {
			return;
		}
		System.out.print("+");
		for (int i = 0; i != Integer.parseInt(args[0]); i++) {
			System.out.print("-+");
		}
		System.out.println();

		for(int j = 0; j != Integer.parseInt(args[0]); j++) {
			System.out.print("|");
			for (int i = 0; i != Integer.parseInt(args[0]); i++) {
				System.out.print(" |");
			}
			System.out.println();

			System.out.print("+");
			for (int i = 0; i != Integer.parseInt(args[0]); i++) {
				System.out.print("-+");
			}
			System.out.println();
		}
	}
}