try{ // Open the file that is the first // command line parameter FileInputStream fstream = new FileInputStream("Inventory2.dat"); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; //Read File Line By Line while ((strLine = br.readLine()) != null) { // Print the content on the console ind.append(strLine); } //Close the input stream in.close(); }catch (Exception e){//Catch exception if any System.err.println("Error: " + e.getMessage()); }
The code works but it does not display the information correctly. its in .dat file as:
Item Number
item Quantity
Item Color
but instead it shows up as :
ItemNumberItemQuantityItemColor
how do i change it to show up correctly?