Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 175685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:44:34+00:00 2026-05-11T13:44:34+00:00

my question is related to my previous question ( How to display data from

  • 0

my question is related to my previous question (How to display data from txt file in specific format).

I was wondering if it is possible at the first place, to store data on txt file in specific format rather than store it first and then retreived it again and display it in specific format?

e.g. instead of store data on txt file like this

 Jessica  Walking 20 minutes Matthew Run  10 minutes 

I wanted to store it in txt file in this format

 Jessica   Walking    20 minutes Matthew   Run        10 minutes  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:44:35+00:00Added an answer on May 11, 2026 at 1:44 pm

    Regarding your comment to adeel’s answer:

    Thanks adeel825, however I dont know where to put the ‘\t’.. so far I use this method: new PrintStream(fout).println (name); new PrintStream(fout).println (exercise); new PrintStream(fout).println(’10 minutes’);

    First, don’t call ‘new PrintStream(fout)‘ everytime you print something. Do this:

    PrintStream ps = new PrintStream(fout); ps.print(name); ps.print('\t'); ps.print(exercise); ps.print('\t'); ps.print(time); ps.println(); 

    Or simply:

    PrintStream ps = new PrintStream(fout); ps.println(name + '\t' + exercise + '\t' + time); 

    Edit

    In response to your comment:

    one more question…some of the name are too long and it requires more tab..I have put ps.print(‘\t’,’\t’); but it seems not working..

    If this is a problem, it sounds like you are trying to store them in the manner you want to display them. I had assumed you were trying to store them in a way that would be easy to parse programmatically. If you want to store them displayed in columns, I’d suggest padding with spaces rather than tabs.

    If you know that all the columns are going to be less than, say, 30 characters wide, you could do something like this with printf:

    ps.printf('%30s%30s%30s%n', name, exercise, time); 

    That syntax can look quite byzantine if you’re not used to it.. basiclly each ‘%30s’ means pad the string argument so that it is at least 30 characters wide. Your result won’t look right if any of the values are 30 or more characters wide. If you can’t know ahead of time, you’ll have to loop through the values in each column to determine how wide the columns need to be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is related to the previous post. How to save file and read
This is a CSS related question, I got one good answer from my previous
Related to my previous question , I have a string on the following format:
My question is related with the previous solved question in How to save data
This question is directly related to my previous question ASP.NET AJAX Is it possible
This is a follow-up question related to my previous post . Below is a
This question is related to a previous question of mine That's my current code
This question is related to my previous question How to generate Cartesian Coordinate (x,y)
This question is related to my previous question . The storyline: I have an
This question is related to a previous post . Is there something comparable to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.