sysrep:rmi
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sysrep:rmi [2013/12/04 14:24] – [Hello World] orel | sysrep:rmi [2024/03/18 15:06] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 129: | Line 129: | ||
| __Exercice__ : | __Exercice__ : | ||
| * Faire une proposition d' | * Faire une proposition d' | ||
| - | * Implantation. Utilisez les compléments Java fournis à la fin de cette page ;-) | + | * Implantation. Utilisez les compléments Java disponibles [[sysrep: |
| * Quelques éléments de correction pour vous aider : [[sysrep: | * Quelques éléments de correction pour vous aider : [[sysrep: | ||
| Line 196: | Line 196: | ||
| __Tutoriel__ : http:// | __Tutoriel__ : http:// | ||
| - | ====Compléments Java==== | + | ====Fourmis==== |
| - | __Readline__ | + | FIXME : Ajouter un nouvel exo sur un programme Java simulant l' |
| - | <code java> | ||
| - | BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); | ||
| - | try { | ||
| - | String msg = in.readLine(); | ||
| - | } catch(IOException e) { /* ... */ } | ||
| - | </ | ||
| - | |||
| - | __StringTokenizer__ : Pour décomposer une chaîne de caractères en mots (les //tokens//) : | ||
| - | |||
| - | <code java> | ||
| - | StringTokenizer st = new StringTokenizer(" | ||
| - | while (st.hasMoreTokens()) System.out.println(st.nextToken()); | ||
| - | </ | ||
| - | |||
| - | Affiche ici : | ||
| - | |||
| - | this | ||
| - | is | ||
| - | a | ||
| - | test | ||
| - | |||
| - | |||
| - | __HashMap and Generics__ : Voici un petit exemple d' | ||
| - | |||
| - | <code java> | ||
| - | HashMap< | ||
| - | map.put(1, " | ||
| - | map.put(2, " | ||
| - | String name = map.get(2) | ||
| - | |||
| - | for (Integer key : map.keySet()) | ||
| - | System.out.println(" | ||
| - | </ | ||
| - | |||
| - | __Intrinsic Locks and Synchronization__ : En java chaque objet dispose d'un verrou intrinséque (mutex), qui est utile pour synchroniser l' | ||
| - | |||
| - | <code java> | ||
| - | class FooBar { | ||
| - | synchronized void foo() { ...} | ||
| - | synchronized void bar() { ...} | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | Soit on déclare un bloc de code " | ||
| - | |||
| - | <code java> | ||
| - | Object lock = new Object; | ||
| - | synchronized(lock) { | ||
| - | ... | ||
| - | ... | ||
| - | } | ||
| - | </ | ||
sysrep/rmi.1386167059.txt.gz · Last modified: 2024/03/18 15:05 (external edit)
