Új hozzászólás Aktív témák
-
btotyi
tag
Például így :
package test;
class Szal extends java.lang.Thread {
volatile static boolean Stop = false;
// Primordial thread executes main()
public static void main(String args[]) throws InterruptedException {
// Create and start 2 threads
Szal thread1 = new Szal();
thread1.setPriority(1); // 1st thread at 1th non-RT priority
Szal thread2 = new Szal();
thread2.setPriority(1); // 2nd thread at 1th non-RT priority
thread1.start(); // start 1st thread to execute run()
thread2.start(); // start 2nd thread to execute run()
// Sleep for 10 seconds, then tell the threads to terminate
Thread.sleep(10 * 1000);
Stop = true;
}
public void run() { // Created threads execute this method
System.out.println(''Created thread'');
int count = 0;
for (; Stop != true;) { // continue until asked to stop
count++;
Thread.yield(); // yield to other thread
}
System.out.println(''Thread terminates. Loop count is '' + count);
}
}
forrás:[link]
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- PlayStation 4 Pro 1TB 7216B, frissen pasztázva, 6 hó garanciával, Bp-i üzletből eladó!
- Xiaomi Redmi Note 12 128GB, Kártyafüggetlen, 1 Év Garanciával
- Samsung Galaxy Tab A7 Lite 8,7" 3/32GB Wifi (SM-T220) szürke színben
- Apple iPad Air 5 10.9" (M1 Chip) 5G/64GB/8GB WiFi+Cellular
- Apple Iphone 16 Pro White Titanium (07.25-ei vásárlás)
- HIBÁTLAN iPhone 12 Pro Max 256GB Gold -1 ÉV GARANCIA - Kártyafüggetlen, MS3299,100% Akkumulátor
- ÁRGARANCIA!Épített KomPhone i5 14400F 32/64GB DDR5 RTX 5060 Ti 8GB GAMER PC termékbeszámítással
- REFURBISHED és ÚJ - Lenovo ThinkPad Ultra Docking Station (40AJ)
- BESZÁMÍTÁS! ASUS H510M i5 10400F 32GB DDR4 512GB SSD RX 6600XT 8GB ZALMAN M4 Cooler Master 650W
- Új monitor állvány- elegáns megoldás a dupla A/4-es papírcsomag helyett - csak össze lett szerelve
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: NetGo.hu Kft.
Város: Gödöllő



