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 Talk!
JAVA
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="akhilapraveen" data-source="post: 10765214" data-attributes="member: 104181"><p><span style="color: Blue">machan umba ahala tiyenna niyama prashnayak! meka java lovers late hugak ona wei!</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">We all know to save data , we use databases such as SQL in every software. But the problem with this is If the data are saved in a database, User has to instal SQL sever with the software to work properly!</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">This is pointless Coz installing the database with the software is hard!</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">But Im gonna show you guys a way to save data in a text sheet without implementing databases!(This way is used by many modern softwares!!)</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">here it is...</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">//-------------------------------------------------------------------------</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">import javax.swing.JTextField;</span></p><p><span style="color: Blue">import java.io.*;</span></p><p><span style="color: Blue">import javax.swing.JOptionPane;</span></p><p><span style="color: Blue">/**</span></p><p> <span style="color: Blue">*</span></p><p> <span style="color: Blue">* @author Akhila</span></p><p> <span style="color: Blue">*/</span></p><p><span style="color: Blue">public class JavaApplication12 {</span></p><p> <span style="color: Blue"></span></p><p><span style="color: Blue"></span></p><p> <span style="color: Blue"></span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> public void write(String text){</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> String theline=text;</span></p><p><span style="color: Blue">try{</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> FileOutputStream fout; </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> //NOW ARE GIVING A PATH TO CREATE THE TEXT FILE, GIVE YOUR OWN PATH (THIS IS THE PATH FOR MY PC)</span></p><p><span style="color: Blue"> fout = new FileOutputStream ("C:\\Users\\Akhila\\Documents\\akhila docs\\MYTEXT.txt");</span></p><p><span style="color: Blue"> //PREVIOUS LINE HAS CREATED A TEXT FIILE CALLED MYTEXT.txt </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> new PrintStream(fout).println (theline);</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"> fout.close();</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> }</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> catch(Exception e){}</span></p><p><span style="color: Blue"> }</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> }</span></p><p><span style="color: Blue">//-----------------------------------------------------------------------------</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">NOW WE HAVE WRITTEN DATA TO A TEXT FILE NOW HERE THE CODING TO READ IT!</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">//-------------------------------------------------------------------------</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">import java.io.*;</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">public class JavaApplication12{</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> public String Read(){</span></p><p><span style="color: Blue"> String line="";</span></p><p><span style="color: Blue"> FileInputStream fin; </span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"> try</span></p><p><span style="color: Blue"> {</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> //give the path of the created file</span></p><p><span style="color: Blue"> fin = new FileInputStream ("C:\\Users\\Akhila\\Documents\\akhila docs\\MYTEXT.txt");</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"> line=( new DataInputStream(fin).readLine() );</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> fin.close(); </span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> return line;</span></p><p><span style="color: Blue"> }</span></p><p><span style="color: Blue"> </span></p><p><span style="color: Blue"> catch (Exception e)</span></p><p><span style="color: Blue"> {</span></p><p><span style="color: Blue"> return line;</span></p><p><span style="color: Blue"> }</span></p><p><span style="color: Blue"> } </span></p><p><span style="color: Blue">}</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">//-------------------------------------------------------------------------------</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">Machan this is the way to do this! i know your using this coding for a small thing But By edting this code you can create a database in a text file and encrypt it also!!</span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue">ENJOY!!! </span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"></span></p></blockquote><p></p>
[QUOTE="akhilapraveen, post: 10765214, member: 104181"] [COLOR=Blue]machan umba ahala tiyenna niyama prashnayak! meka java lovers late hugak ona wei! We all know to save data , we use databases such as SQL in every software. But the problem with this is If the data are saved in a database, User has to instal SQL sever with the software to work properly! This is pointless Coz installing the database with the software is hard! But Im gonna show you guys a way to save data in a text sheet without implementing databases!(This way is used by many modern softwares!!) here it is... //------------------------------------------------------------------------- import javax.swing.JTextField; import java.io.*; import javax.swing.JOptionPane; /** * * @author Akhila */ public class JavaApplication12 { public void write(String text){ String theline=text; try{ FileOutputStream fout; //NOW ARE GIVING A PATH TO CREATE THE TEXT FILE, GIVE YOUR OWN PATH (THIS IS THE PATH FOR MY PC) fout = new FileOutputStream ("C:\\Users\\Akhila\\Documents\\akhila docs\\MYTEXT.txt"); //PREVIOUS LINE HAS CREATED A TEXT FIILE CALLED MYTEXT.txt new PrintStream(fout).println (theline); fout.close(); } catch(Exception e){} } } //----------------------------------------------------------------------------- NOW WE HAVE WRITTEN DATA TO A TEXT FILE NOW HERE THE CODING TO READ IT! //------------------------------------------------------------------------- import java.io.*; public class JavaApplication12{ public String Read(){ String line=""; FileInputStream fin; try { //give the path of the created file fin = new FileInputStream ("C:\\Users\\Akhila\\Documents\\akhila docs\\MYTEXT.txt"); line=( new DataInputStream(fin).readLine() ); fin.close(); return line; } catch (Exception e) { return line; } } } //------------------------------------------------------------------------------- Machan this is the way to do this! i know your using this coding for a small thing But By edting this code you can create a database in a text file and encrypt it also!! ENJOY!!! [/COLOR] [/QUOTE]
Insert quotes…
Verification
Dawasata paya keeyak thibeda?
Post reply
Top
Bottom