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
Education
~~~~~~~~~~~~Java Mega Tread~~~~~~~~~~~~~
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="Geshi95" data-source="post: 18989823" data-attributes="member: 539934"><p><span style="font-size: 18px"><img src="/styles/default/xenforo/smilies/default/cool.gif" class="smilie" loading="lazy" alt=":cool:" title="Cool :cool:" data-shortname=":cool:" /><img src="/styles/default/xenforo/smilies/default/cool.gif" class="smilie" loading="lazy" alt=":cool:" title="Cool :cool:" data-shortname=":cool:" />අද බලමු ඉතිරි ටික.<img src="/styles/default/xenforo/smilies/default/nerd.gif" class="smilie" loading="lazy" alt=":nerd:" title="Nerd :nerd:" data-shortname=":nerd:" /><img src="/styles/default/xenforo/smilies/default/nerd.gif" class="smilie" loading="lazy" alt=":nerd:" title="Nerd :nerd:" data-shortname=":nerd:" /><img src="/styles/default/xenforo/smilies/default/nerd.gif" class="smilie" loading="lazy" alt=":nerd:" title="Nerd :nerd:" data-shortname=":nerd:" /></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">float සහ double data types වල values තියා ගන්න පුළුවන් පහත ආකාරයට.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">float f = 3.14;(මෙහෙම තියන්න බෑ මේක වැරදියි <img src="/styles/default/xenforo/smilies/default/dull.gif" class="smilie" loading="lazy" alt=":dull:" title="Dull :dull:" data-shortname=":dull:" />)</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">double d = 3.14;</span></p><p><span style="font-size: 18px">float f = (float)3.14;</span></p><p><span style="font-size: 18px">float f = 3.14f;</span></p><p><span style="font-size: 18px">float f = 3.14F;</span></p><p><span style="font-size: 18px">double d = 3.14d;</span></p><p><span style="font-size: 18px">double d = 3.14D;</span></p><p><span style="font-size: 18px">(මේ හැම විදියටම පුළුවන්<img src="/styles/default/xenforo/smilies/default/happy.gif" class="smilie" loading="lazy" alt=":)" title="Happy :)" data-shortname=":)" />)</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">char වලට තියා ගන්න පුළුවන් Character එකක් විතරයි.<img src="/styles/default/xenforo/smilies/default/eek.gif" class="smilie" loading="lazy" alt=":eek:" title="eek :eek:" data-shortname=":eek:" /><img src="/styles/default/xenforo/smilies/default/eek.gif" class="smilie" loading="lazy" alt=":eek:" title="eek :eek:" data-shortname=":eek:" /><img src="/styles/default/xenforo/smilies/default/eek.gif" class="smilie" loading="lazy" alt=":eek:" title="eek :eek:" data-shortname=":eek:" /></span></p><p><span style="font-size: 18px">උදා -: char c = 'A';</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">නෑ නෑ තව දේවල් පුළුවන්. <img src="/styles/default/xenforo/smilies/default/oo.gif" class="smilie" loading="lazy" alt=":oo:" title="Oo :oo:" data-shortname=":oo:" /></span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">char c = 'a';</span></p><p><span style="font-size: 18px">char c = 0 - 65535; (0 ඉදන් 65535 වෙනකන් අංක පුළුවන්)</span></p><p><span style="font-size: 18px">char c = '\b', '\n', '\t'; (escape characters)</span></p><p><span style="font-size: 18px">char c = ‘\u0000’-’\uffff’; (unicodes)</span></p><p><span style="font-size: 18px">char c = 0x0000-0xffff; (hexadecimal)</span></p><p><span style="font-size: 18px">char c = (char)-98; (- සංඛ්යා cast කර ලබා දිය යුතුය)</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">char variable දෙකක් එකතු කළ විට assign කර ඇති character එකේ ascii value එක එකතු කිරීම හෝ අඩු කිරීම සිදු වේ.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">උදා -: </span></p><p><span style="font-size: 18px">class A{</span></p><p><span style="font-size: 18px"> public static void main(String args[]){</span></p><p><span style="font-size: 18px"> char a = 'a';</span></p><p><span style="font-size: 18px"> char b = 'b';</span></p><p><span style="font-size: 18px"> System.out.println(b-a);</span></p><p><span style="font-size: 18px"> }</span></p><p><span style="font-size: 18px">}</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">මෙහිදී output එක 1 ලෙස ලැබේ.a හි ascii value එක 97 වන අතර b හි 98 වේ.එනම් </span></p><p><span style="font-size: 18px">b-a = 1 ලෙස output එක ලැබේ.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">boolean වලට simple අකුරු වලින් true හෝ false පමණක් assign කළ හැක.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">boolean b = true;</span></p><p><span style="font-size: 18px">boolean b = false;</span></p><p><span style="font-size: 18px">(මෙහෙම ok <img src="/styles/default/xenforo/smilies/default/happy.gif" class="smilie" loading="lazy" alt=":)" title="Happy :)" data-shortname=":)" />)</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">boolean b = 0;</span></p><p><span style="font-size: 18px">boolean b = 1;</span></p><p><span style="font-size: 18px">(මෙහෙම බෑ <img src="/styles/default/xenforo/smilies/default/no.gif" class="smilie" loading="lazy" alt=":no:" title="No :no:" data-shortname=":no:" />)</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">Variables ප්රධාන වශයෙන් කොටස් 2කට බෙදන්න පුළුවන්.</span></p><p><span style="font-size: 18px">1. Global Variables</span></p><p><span style="font-size: 18px">2. Local Variables</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">Global Variables තවත් කොටස් 2කට බෙදෙනවා.</span></p><p><span style="font-size: 18px">1. Static Variables</span></p><p><span style="font-size: 18px">2. Instance Variables</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">Local Variables කොටස් දෙකකට බෙදෙනවා.</span></p><p><span style="font-size: 18px">1. Method Local Variables</span></p><p><span style="font-size: 18px">2. Block Variables</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px"><u><span style="font-size: 22px">Static Variable</span></u></span></p><p><span style="font-size: 18px">Static Variable එකක් යනු static keyword එක දාපු Global Variable එකකි.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">class A{</span></p><p><span style="font-size: 18px"> <span style="color: Red">static int i;</span></span></p><p><span style="font-size: 18px"><span style="color: Red"> static int j = 10;</span></span></p><p><span style="font-size: 18px"> public static void main(String args[]){</span></p><p><span style="font-size: 18px"> }</span></p><p><span style="font-size: 18px">}</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">ලක්ෂණ -:</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">o variable එකේ නමින්ම call කල හැක.</span></p><p><span style="font-size: 18px">class A{</span></p><p><span style="font-size: 18px"><span style="color: red"> static int i = 10;</span></span></p><p><span style="font-size: 18px"> public static void main(String args[]){</span></p><p><span style="font-size: 18px"> <span style="color: red">System.out.println(A.i);</span></span></p><p><span style="font-size: 18px"> }</span></p><p><span style="font-size: 18px">}</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">output - 10</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">o classes කිහිපයක් භාවිතා කරන විට class එකේ නමින්ම call කල හැක.එනම් වෙන class එකක ඇති static variables වලට තවත් class එකක සිට එම class එකේ නමින් call කල හැක.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">class A{</span></p><p><span style="font-size: 18px"> static int i = 10;</span></p><p><span style="font-size: 18px"> public static void main(String args[]){</span></p><p><span style="font-size: 18px"> System.out.println(i);</span></p><p><span style="font-size: 18px"> <span style="color: red">System.out.println(B.x);</span></span></p><p><span style="font-size: 18px"> }</span></p><p><span style="font-size: 18px">}</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">class B{</span></p><p><span style="font-size: 18px"> <span style="color: red">static int x = 20;</span></span></p><p><span style="font-size: 18px">}</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">output - 10</span></p><p><span style="font-size: 18px"> 20</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">o Static variables සෑදිය හැක්කේ class scope එකක් තුළ පමණි.method එකක් තුළ Static variables සෑදිය නොහැක.</span></p><p><span style="font-size: 18px"></span></p><p><span style="font-size: 18px">ඉතිරි ටික ඉක්මණටම දාන්නම්.නැත්නම් නිදිමතේ මොනව කියයිද දන්නෙ නෑ.<img src="/styles/default/xenforo/smilies/default/dull.gif" class="smilie" loading="lazy" alt=":dull:" title="Dull :dull:" data-shortname=":dull:" /><img src="/styles/default/xenforo/smilies/default/dull.gif" class="smilie" loading="lazy" alt=":dull:" title="Dull :dull:" data-shortname=":dull:" /><img src="/styles/default/xenforo/smilies/default/dull.gif" class="smilie" loading="lazy" alt=":dull:" title="Dull :dull:" data-shortname=":dull:" /></span></p><p><span style="font-size: 18px">වැරදි අඩුපාඩු එහෙම තියෙනව නම් කියන්න හොදේ.....</span></p><p><span style="font-size: 18px">අනේ මට මේකට පින්තූර දාන්නෙ කොහොමද කියල දන්න කෙනෙක් කියල දෙන්නකෝ.දාන්න හදපු හැම එකම දාන්න බෑලුනෙ.<img src="/styles/default/xenforo/smilies/default/no.gif" class="smilie" loading="lazy" alt=":no:" title="No :no:" data-shortname=":no:" /><img src="/styles/default/xenforo/smilies/default/no.gif" class="smilie" loading="lazy" alt=":no:" title="No :no:" data-shortname=":no:" /><img src="/styles/default/xenforo/smilies/default/no.gif" class="smilie" loading="lazy" alt=":no:" title="No :no:" data-shortname=":no:" /></span></p><p><span style="font-size: 18px">එහෙනම් හැමෝටම බුදුසරණයි!</span></p><p><span style="font-size: 18px"><img src="/styles/default/xenforo/smilies/default/cool.gif" class="smilie" loading="lazy" alt=":cool:" title="Cool :cool:" data-shortname=":cool:" /><img src="/styles/default/xenforo/smilies/default/cool.gif" class="smilie" loading="lazy" alt=":cool:" title="Cool :cool:" data-shortname=":cool:" /><img src="/styles/default/xenforo/smilies/default/cool.gif" class="smilie" loading="lazy" alt=":cool:" title="Cool :cool:" data-shortname=":cool:" /><img src="/styles/default/xenforo/smilies/default/cool.gif" class="smilie" loading="lazy" alt=":cool:" title="Cool :cool:" data-shortname=":cool:" /><img src="/styles/default/xenforo/smilies/default/cool.gif" class="smilie" loading="lazy" alt=":cool:" title="Cool :cool:" data-shortname=":cool:" /></span></p></blockquote><p></p>
[QUOTE="Geshi95, post: 18989823, member: 539934"] [SIZE="5"]:cool::cool:අද බලමු ඉතිරි ටික.:nerd::nerd::nerd: float සහ double data types වල values තියා ගන්න පුළුවන් පහත ආකාරයට. float f = 3.14;(මෙහෙම තියන්න බෑ මේක වැරදියි :dull:) double d = 3.14; float f = (float)3.14; float f = 3.14f; float f = 3.14F; double d = 3.14d; double d = 3.14D; (මේ හැම විදියටම පුළුවන්:)) char වලට තියා ගන්න පුළුවන් Character එකක් විතරයි.:eek::eek::eek: උදා -: char c = 'A'; නෑ නෑ තව දේවල් පුළුවන්. :oo: char c = 'a'; char c = 0 - 65535; (0 ඉදන් 65535 වෙනකන් අංක පුළුවන්) char c = '\b', '\n', '\t'; (escape characters) char c = ‘\u0000’-’\uffff’; (unicodes) char c = 0x0000-0xffff; (hexadecimal) char c = (char)-98; (- සංඛ්යා cast කර ලබා දිය යුතුය) char variable දෙකක් එකතු කළ විට assign කර ඇති character එකේ ascii value එක එකතු කිරීම හෝ අඩු කිරීම සිදු වේ. උදා -: class A{ public static void main(String args[]){ char a = 'a'; char b = 'b'; System.out.println(b-a); } } මෙහිදී output එක 1 ලෙස ලැබේ.a හි ascii value එක 97 වන අතර b හි 98 වේ.එනම් b-a = 1 ලෙස output එක ලැබේ. boolean වලට simple අකුරු වලින් true හෝ false පමණක් assign කළ හැක. boolean b = true; boolean b = false; (මෙහෙම ok :)) boolean b = 0; boolean b = 1; (මෙහෙම බෑ :no:) Variables ප්රධාන වශයෙන් කොටස් 2කට බෙදන්න පුළුවන්. 1. Global Variables 2. Local Variables Global Variables තවත් කොටස් 2කට බෙදෙනවා. 1. Static Variables 2. Instance Variables Local Variables කොටස් දෙකකට බෙදෙනවා. 1. Method Local Variables 2. Block Variables [U][SIZE="6"]Static Variable[/SIZE][/U] Static Variable එකක් යනු static keyword එක දාපු Global Variable එකකි. class A{ [COLOR="Red"]static int i; static int j = 10;[/COLOR] public static void main(String args[]){ } } ලක්ෂණ -: o variable එකේ නමින්ම call කල හැක. class A{ [COLOR="red"] static int i = 10;[/COLOR] public static void main(String args[]){ [COLOR="red"]System.out.println(A.i);[/COLOR] } } output - 10 o classes කිහිපයක් භාවිතා කරන විට class එකේ නමින්ම call කල හැක.එනම් වෙන class එකක ඇති static variables වලට තවත් class එකක සිට එම class එකේ නමින් call කල හැක. class A{ static int i = 10; public static void main(String args[]){ System.out.println(i); [COLOR="red"]System.out.println(B.x);[/COLOR] } } class B{ [COLOR="red"]static int x = 20;[/COLOR] } output - 10 20 o Static variables සෑදිය හැක්කේ class scope එකක් තුළ පමණි.method එකක් තුළ Static variables සෑදිය නොහැක. ඉතිරි ටික ඉක්මණටම දාන්නම්.නැත්නම් නිදිමතේ මොනව කියයිද දන්නෙ නෑ.:dull::dull::dull: වැරදි අඩුපාඩු එහෙම තියෙනව නම් කියන්න හොදේ..... අනේ මට මේකට පින්තූර දාන්නෙ කොහොමද කියල දන්න කෙනෙක් කියල දෙන්නකෝ.දාන්න හදපු හැම එකම දාන්න බෑලුනෙ.:no::no::no: එහෙනම් හැමෝටම බුදුසරණයි! :cool::cool::cool::cool::cool:[/SIZE] [/QUOTE]
Insert quotes…
Verification
Dahaya deken beduwama keeyada?
Post reply
Top
Bottom