Note that there are some explanatory texts on larger screens.

plurals
  1. POFile Reader Format
    primarykey
    data
    text
    <p>This project I'm working on, here is the function which write data's in to file :</p> <pre><code> public void writetofile(){ String bucky[]={custname,custlname,agee,address,id}; for(int i = 0; i &lt; bucky.length; i++) { try (BufferedWriter bw = new BufferedWriter(new FileWriter("records.txt", true))) { String s; s = bucky[i]; bw.write(s); bw.newLine(); bw.flush(); } catch(IOException ex) { JOptionPane.showMessageDialog(null, "Error In File"); } } }; </code></pre> <p>and there is another function defined which reads data's from file , </p> <pre><code> public void filereader (){ int i=0; Object[] options = {"OK"}; try { FileInputStream in = new FileInputStream("records.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; StringBuffer sb = new StringBuffer(); while((strLine = br.readLine())!= null) { sb.append(strLine +"\n"); } JOptionPane.showMessageDialog( null, sb.toString()); }catch(Exception e){ JOptionPane.showOptionDialog(null, "Error", "Customers", JOptionPane.PLAIN_MESSAGE,JOptionPane.QUESTION_MESSAGE, null, options, options[0]); } }; </code></pre> <p>and the problem is , let's say I want to create an account for a customer in my project , so few questions were asked such as name , last name , gender , etc. and all those info's have been saved , but when I try to read files all the data's will appear in no format , I want them to be appear in the proper way like this : </p> <pre><code>customer name : Michelle , gender : Female ; </code></pre> <p>but right now it appears as this : </p> <pre><code>michelle , female , </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload