SiteBtsio2019

LeLangageJava

Les fondamentaux du langage Java

La structure.
public class Hello {
  • public static void main (String[] args) {
    • System.out.println("Bonjour les BTS SIO");
  • }
}
Le fichier devra être enregistré sous le nom Hello.java


Les variables.
  • String ch = "Bonjour";
  • int x = 7;


Les boucles.
public static void inverserTableau(int t[]) {
  • int a= 0; int b= t.length -1;
    • while (a < b) {
      • int tmp= t[a];
      • t[a]= t[b];
      • t[b]= tmp;
      • a++;
      • b--;
    • }
  • }


Les tests.
if (t <7) {
  • ...
}



Les sous programmes
public static void afficherTableau(int t[]) {
  • for (int i= 0; i < t.length; i++) {
    • System.out.print(t[i]);
    • if (i != t.length -1)
      • System.out.print(' ');
  • }



Les tableaux.
int t[]= {8, 2, 1, 23, 7, 12, 77};



Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]