473,327 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

storing file

hi i've got this code, I want to store this in a file and the output will be

"1*2*4*5*6*8*9*10"

can anyone plz help me to find this out...

here is the code

Code:
public String printPositive Integers()
{
for(int i=1; i<=10; i++)
{
System.out.print("*"+i);
}
}
Feb 17 '08 #1
3 1227
A good place to start would be Importing
java.io.*;

You are going to want to read some of Sun's tutorials involving Buffered Reader, and Outfiles.
Feb 18 '08 #2
Nepomuk
3,112 Expert 2GB
hi i've got this code, I want to store this in a file and the output will be

"1*2*4*5*6*8*9*10"

can anyone plz help me to find this out...

here is the code

Code:
public String printPositive Integers()
{
for(int i=1; i<=10; i++)
{
System.out.print("*"+i);
}
}
By the way, that code will give you
Expand|Select|Wrap|Line Numbers
  1. *1*2*3*4*5*6*7*8*9*10
  2.  
(so there's an extra * at the beginning.)
To solve this, you could use an if-section in the loop or write the first number outside of the loop or...

Also, about writing files, this Howto could be what you're looking for. (Although of course, Sun's tutorials are much bigger and therefore you can learn much more.)

Greetings,
Nepomuk
Feb 18 '08 #3
BigDaddyLH
1,216 Expert 1GB
You can always redirect stdout from the command line:

Java YourProgram > stdout.txt
Feb 18 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tony | last post by:
Hi, I have dynamically created a PDF document in memory as a FileOutputStream Now I have to get it into a DB2 table, storing it as a BLOB. The table has a document id, document name, some date...
5
by: Don Vaillancourt | last post by:
I'm building a system when one can upload a document to the website. I will be storing the document on the hard-drive for quick/easy access, but I was also thinking of storing it in an existing...
4
by: Rednelle | last post by:
Greetings all, As a newbie, using Access 2000, I would appreciate advice on the best way to include pictures. I have developed a 'Home Inventory' database which can include jpeg thumbnails of...
3
by: Kevin L | last post by:
I want to store database credentials in either the registry or a file. What is the easiest way to encrypt this information?
7
by: C G | last post by:
Dear All, What's the best way to store jpgs in postgresql to use in a web page? I tried to use large objects, but how would you extract them from a table to be viewed in a web-page without...
2
by: Eduardo Pérez Ureta | last post by:
I was wondering what the best way is to store a file hash (MD5 or SHA1) and make it primary key indexed. I have seen some people storing the hexadecimal encoded MD5 in a CHAR(32) but it may be a...
5
by: Demetri | last post by:
Unfortunately, where I work it is forbidden to use stored procedures. I know, I know...it's pretty stupid. But I can not change that. Anyway, currently we have our sql stored in an embedded resx...
6
by: (PeteCresswell) | last post by:
User wants to go this route instead of storing pointers in the DB and the documents outside. Only time I tried it was with only MS Word docs - and that was a loooong time ago - and it seemed to...
3
by: ArmsTom | last post by:
I was using structures to store information read from a file. That was working fine for me, but then I read that anything stored in a structure is added to the stack and not the heap. So, I made...
6
by: psbasha | last post by:
Hi , Currenty I am storing the Graphical User Interface options in a string memeber variable of a class as show below: SampleCode Tkinter Modules ( Graphical User Interface):...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.