-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPrintln.java
More file actions
42 lines (38 loc) · 1.74 KB
/
Println.java
File metadata and controls
42 lines (38 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Exemples avec <pre>System.out.println()</pre><p>
* Les notes détaillées sont dans le manuel du cours
* @author physcrowley (2022-10)
*/
public class Println {
public static void main(String[] args) {
int a = 3;
double x = 3.5;
String s = "coucou";
System.out.println( a ); // convertit int -> String et l'affiche
System.out.println( x ); // convertit double -> String et l'affiche
System.out.println( s ); // affiche le String
System.out.println( a + x + s ); // évalue le calcul avant la concaténation
System.out.println(); // ligne vide
// slalom - un ASCII art pathétique
System.out.println("x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
System.out.println(" x ");
}
}