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
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 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
Haya warak paha keeyada? (haya wadi kireema paha)
Post reply
Top
Bottom