Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
ZTE MF283U 4G Unlocked Router (Used)
ayanthamaxi
Updated:
Sunday at 8:26 PM
ලංකාවේ හොඳම උපකාරක පන්ති සහ ගුරුවරුන් එකම තැනකින් - TopTuition.lk
dulithapathum
Updated:
Saturday at 8:07 AM
Colombo
RidhMathraa ’26 🎶✨
Tmadhusanka
Updated:
Jul 15, 2026
Ad icon
Colombo
PXN V10 Pro Direct Drive Racing Wheel (Under Warranty)
Abdur Rahman
Updated:
Jul 15, 2026
Ad icon
USDT ණය සේවාව - USDT Loan Service
පුරවැසියා
Updated:
Jul 15, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Java thread question
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="ShehanAM" data-source="post: 22387711" data-attributes="member: 561520"><p><span style="font-size: 15px">Java Multithread pothaka example ekaka mehemma code ekak thibba.</span> </p><p>[CODE][SIZE="3"][FONT="Lucida Console"][COLOR="Indigo"]public class Main {</p><p> private static boolean done;</p><p></p><p> public static void main(final String[] args) throws InterruptedException {</p><p> new Thread(new Runnable() {</p><p> public void run() {</p><p> int i = 0;</p><p> while (!done) {</p><p> i++;</p><p> }</p><p> System.out.println("Done!");</p><p> }</p><p> }).start();</p><p></p><p> System.out.println("OS: " + System.getProperty("os.name"));</p><p> Thread.sleep(2000);</p><p> done = true;</p><p> System.out.println("flag done set to true");</p><p> }</p><p>}[/COLOR][/FONT][/SIZE][/CODE]</p><p></p><p><span style="font-size: 15px">meka run kalama "OS ekai, flag done set true" kiyana lines display wenakan wenawa. Eth mata thiyena prashne meke mada thiyena while(!done) loop eken eliyata enna baa neda kiyala? mokada boolean done eke value eka false, ithin ekanisa me code eka hama welema true wenawane, ehenam kohomada code eka while loop eken eliyata awilla ara lines print karanne?.</span></p><p><span style="font-size: 15px"></span></p><p><span style="font-size: 15px">Java waddo help plese karanna, meka mata therum karala kiyanawada ehema wenna hethuwa.</span></p></blockquote><p></p>
[QUOTE="ShehanAM, post: 22387711, member: 561520"] [SIZE="4"]Java Multithread pothaka example ekaka mehemma code ekak thibba.[/SIZE] [CODE][SIZE="3"][FONT="Lucida Console"][COLOR="Indigo"]public class Main { private static boolean done; public static void main(final String[] args) throws InterruptedException { new Thread(new Runnable() { public void run() { int i = 0; while (!done) { i++; } System.out.println("Done!"); } }).start(); System.out.println("OS: " + System.getProperty("os.name")); Thread.sleep(2000); done = true; System.out.println("flag done set to true"); } }[/COLOR][/FONT][/SIZE][/CODE] [SIZE="4"]meka run kalama "OS ekai, flag done set true" kiyana lines display wenakan wenawa. Eth mata thiyena prashne meke mada thiyena while(!done) loop eken eliyata enna baa neda kiyala? mokada boolean done eke value eka false, ithin ekanisa me code eka hama welema true wenawane, ehenam kohomada code eka while loop eken eliyata awilla ara lines print karanne?. Java waddo help plese karanna, meka mata therum karala kiyanawada ehema wenna hethuwa.[/SIZE] [/QUOTE]
Insert quotes…
Verification
Dahaya deken beduwama keeyada?
Post reply
Top
Bottom