λ°©λ²1) Thread ν΄λμ€λ₯Ό μμλ°μ λ§λ€κΈ°
λ°©λ²2) Runnable μΈν°νμ΄μ€λ₯Ό μμλ°μ λ§λ€κΈ°
package review_hell;
import java.awt.Toolkit;
public class Practice3 {
public static void main(String[] args) {
// μμ
1
Toolkit toolkit = Toolkit.getDefaultToolkit();
for (int i = 0; i < 5; i++) {
toolkit.beep();
try {
Thread.sleep(500); // 0.5μ΄ λμ μΌμμ μ§
} catch (InterruptedException e) {
}
}
// μμ
2
for (int i = 0; i < 5; i++) {
System.out.println("λ΅");
try {
Thread.sleep(500); // 0.5μ΄ λμ μΌμμ μ§
} catch (InterruptedException e) {
}
}
}
}