4주차1 [4주차] 직접 해보는 손코딩! Thread public class App { public static void main(String[] args) throws Exception { Runnable r = new Runnable(){ public void save(){ System.out.println("작업 내용을 저장함."); } @Override public void run() { while(true){ try{ Thread.sleep(1000); }catch(Exception e){ } save(); } } }; Thread task = new Thread(r); task.setDaemon(true); task.start(); try{ Thread.sleep(4000); }catch(Exception e){ } System.out.print.. 2020. 2. 29. 이전 1 다음