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
RHCSA, RHCE, AWS, Docker, Kubernetes Training
Sanjeewani95
Updated:
Tuesday at 10:28 AM
🛡️ Kaspersky Antivirus – 1 Year / 1 Device | Rs. 2,300 | Only 9 Left
KSPathirana
Updated:
Monday at 2:42 PM
Ad icon
Professional CCTV Installation Service
Techguy231
Updated:
Sep 6, 2026
Ad icon
I'll research & write an article - Rs. 2000 onwards
Blogerwiki
Updated:
Sep 3, 2026
House Plan
lenura
Updated:
Sep 2, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Java Problem
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="da-one01" data-source="post: 9870631" data-attributes="member: 321679"><p>මේක කෝමද කියලා බලන්න... තේරුන විදිහට කරලා බැලුවා <img src="/styles/default/xenforo/smilies/default/P.gif" class="smilie" loading="lazy" alt=":P" title=":P :P" data-shortname=":P" /> තාම Java වලට අලුත්... <img src="/styles/default/xenforo/smilies/default/wink.gif" class="smilie" loading="lazy" alt=";)" title="Wink ;)" data-shortname=";)" /></p><p></p><p></p><p>[CODE]import java.io.*;</p><p></p><p>public class NewClass {</p><p>public static Console c=System.console();</p><p>public static void main(String[] args) {</p><p></p><p>try{ System.out.println("Enter base \nKey- 2,8,10,16");</p><p>String base1 = c.readLine("Enter Base: ");</p><p>int base2= Integer.parseInt(base1);</p><p>switch (base2) {</p><p></p><p>case 2: System.out.println("you select base 2");</p><p>base2();break;</p><p>case 8: System.out.println("you select base 8");</p><p>base8();break;</p><p>case 10: System.out.println("you select base 10");</p><p>base10();break;</p><p>case 16: System.out.println("you select base 16");</p><p>base16();break;</p><p>default: System.out.println("Error");</p><p>}}</p><p>catch(Exception a) {</p><p>System.out.println("you did a wrong thing");}</p><p></p><p>}</p><p>public static void base2(){</p><p>String num1 = c.readLine("Enter Num: ");</p><p>int n1= Integer.parseInt(num1,2);</p><p>System.out.println(n1);</p><p></p><p>}</p><p>public static void base8(){</p><p>String num1 = c.readLine("Enter Num: ");</p><p>int n1= Integer.parseInt(num1,8);</p><p>System.out.println(n1);</p><p>}</p><p>public static void base10(){</p><p>String num1 = c.readLine("Enter Num: ");</p><p>int n1= Integer.parseInt(num1,10);</p><p>System.out.println(n1);</p><p>}</p><p>public static void base16(){</p><p>String num1 = c.readLine("Enter Num: ",16);</p><p>int n1= Integer.parseInt(num1,16);</p><p>System.out.println(n1);</p><p>}</p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="da-one01, post: 9870631, member: 321679"] මේක කෝමද කියලා බලන්න... තේරුන විදිහට කරලා බැලුවා :P තාම Java වලට අලුත්... ;) [CODE]import java.io.*; public class NewClass { public static Console c=System.console(); public static void main(String[] args) { try{ System.out.println("Enter base \nKey- 2,8,10,16"); String base1 = c.readLine("Enter Base: "); int base2= Integer.parseInt(base1); switch (base2) { case 2: System.out.println("you select base 2"); base2();break; case 8: System.out.println("you select base 8"); base8();break; case 10: System.out.println("you select base 10"); base10();break; case 16: System.out.println("you select base 16"); base16();break; default: System.out.println("Error"); }} catch(Exception a) { System.out.println("you did a wrong thing");} } public static void base2(){ String num1 = c.readLine("Enter Num: "); int n1= Integer.parseInt(num1,2); System.out.println(n1); } public static void base8(){ String num1 = c.readLine("Enter Num: "); int n1= Integer.parseInt(num1,8); System.out.println(n1); } public static void base10(){ String num1 = c.readLine("Enter Num: "); int n1= Integer.parseInt(num1,10); System.out.println(n1); } public static void base16(){ String num1 = c.readLine("Enter Num: ",16); int n1= Integer.parseInt(num1,16); System.out.println(n1); } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Dawasata paya keeyak thibeda?
Post reply
Top
Bottom