Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.
for (int i = 0; i < 5; i++) {
System.out.println("Itération: " + i);
}
String[] fruits = {"Pomme", "Banane", "Orange"};
for (String fruit : fruits) {
System.out.println(fruit);
}
int count = 0;
while (count < 3) {
System.out.println("Compteur: " + count);
count++;
}
final double GRAVITY = 9.81;
int age = 30;
String nom = "Alice";
double pi = 3.14159;
boolean isJavaFun = true;
int jour = 4;
switch (jour) {
case 6:
System.out.println("Samedi");
break;
case 7:
System.out.println("Dimanche");
break;
default:
System.out.println("Jour de semaine");
}
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
int score = 85;
if (score >= 90) {
System.out.println("Excellent");
} else if (score >= 50) {
System.out.println("Passable");
} else {
System.out.println("Échec");
}