이 코드는 Java로 작성했지만 결과가 예상과 다른 이유를 이해할 수 없습니다.자바에서 쓰레드가 어떻게 작동합니까?
사과와 오렌지가 왜 어수선하게 만들어 졌는지 설명 할 수있는 사람이 있습니까?
package first_experiment;
class Orange extends Thread{
public void run(){
for (int i=1 ; i<21 ; i++)
System.out.println(i + " - Orange");
}
}
class Apple extends Thread{
public void run(){
for (int i =1 ; i <11 ; i++)
System.out.println(i + " - Apple");
}
}
public class one{
public static void main (String args[]){
Thread O = new Orange();
Thread A = new Apple();
O.start();
A.start();
}
}
예상되는 결과를 설명하고 결과를 게시 할 수 있습니까? – djechlin