JAVA MULTI-threading 시
인1형녀
2025.04.17
runnable을 상속 받은 dog라는 class가 있습니다../니다..
thread를 이용하여 dog라는 객체를 여러번 실행시키고자 합니다.runnable r1 = new dog();
runnable r2 = new dog();
runnable r3 = new dog();thread th1 = new thread(r1, th1);
thread th2 = new thread(r2, th2);
thread th3 = new thread(r3, th3);
th1.start();
th2.start();
th3.start();이렇게 스레드를 실행 시킨 다음에, 각 실행된 스레드에서dog class의 변수에 접근 할 수 있는 방법은 없나요??dog 작업중 nullpointer exception이 발생하여 원인을 찾기 위해 debug 코드를 작성할려고 하는데..
이렇게 스레드를 실행 시킨 다음에, 각 실행된 스레드에서dog class의 변수에 접근 할 수 있는 방법은 없나요?? 위 방법이 있다면 고수님들 가르쳐 주시고, 위 방법이 없다면
null pointt exception을 debugging 하는 힌트 좀 주세요...