apuntes:introduccion
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
apuntes:introduccion [2023/10/22 12:25] – [Sentencias básicas] Santiago Faci | apuntes:introduccion [2023/10/22 12:28] (current) – [Sentencias prácticas] Santiago Faci | ||
---|---|---|---|
Line 471: | Line 471: | ||
</ | </ | ||
- | ===== Sentencias prácticas | + | ===== Code snippets |
==== Mostrar un mensaje en pantalla ==== | ==== Mostrar un mensaje en pantalla ==== | ||
Line 501: | Line 501: | ||
Scanner teclado = new Scanner(System.in); | Scanner teclado = new Scanner(System.in); | ||
String entrada = teclado.nextLine(); | String entrada = teclado.nextLine(); | ||
+ | </ | ||
+ | |||
+ | ==== Reproducir un fichero de audio ==== | ||
+ | |||
+ | <code java> | ||
+ | try { | ||
+ | File f = new File(" | ||
+ | AudioInputStream audioIn = AudioSystem.getAudioInputStream(f.toURI().toURL()); | ||
+ | Clip clip = AudioSystem.getClip(); | ||
+ | clip.open(audioIn); | ||
+ | clip.start(); | ||
+ | } catch (IOException | UnsupportedAudioFileException | LineUnavailableException ioe) { | ||
+ | ioe.printStackTrace(); | ||
+ | } | ||
</ | </ | ||
apuntes/introduccion.1697977552.txt.gz · Last modified: 2023/10/22 12:25 by Santiago Faci