G
Gelöschtes Mitglied 66042
Gast
Hallo, ich wollte mal wissen, wieso mein Thread nicht parallel läuft. Bzw. was hierbei fehlt?
package one;
Vielen Dank im Voraus
package one;
Java:
public class MyThread extends Thread {
public void run() {
for (int i = 1; i < 11; i++) {
System.out.print(i);
}
}
public static void main(String[] args) {
MyThread obj = new MyThread();
MyThread obj2 = new MyThread();
try {
obj.start();
obj.sleep(500);
obj2.start();
obj2.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Vielen Dank im Voraus
Zuletzt bearbeitet von einem Moderator: