Link to home
Start Free TrialLog in
Avatar of lwinkenb
lwinkenb

asked on

Question with writing to files

I want to know how to create text files with variable names.

For instance, let's say I want to create a text file called "File0".  Later I want to create a text file called "File1", and so on.

How would I create a file that has a variable in it's name that I can just keep incrementing?

I hope you guys understand what Im asking :)
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lwinkenb
lwinkenb

ASKER

Thanks objects.

How would I do the same thing for variable names?  Let's say I wanted to make a bunch of integers like

int integer0 = someRandomNumber;
int integer1 = someRandomNumber;
int integer2 = someRandomNumber;
...
you can't sorry.
Why not use an array instead:
int[] integer = new int[3];
integer[0] = someRandomNumber;
integer[1] = someRandomNumber;
integer[2] = someRandomNumber;
Thanks objects.

How would I do the same thing for variable names?  Let's say I wanted to make a bunch of integers like

int integer0 = someRandomNumber;
int integer1 = someRandomNumber;
int integer2 = someRandomNumber;
...
Thanks again!
No worries, thanks for the points :)

http://www.objects.com.au/staff/mick
Brainbench MVP for Java 1
http://www.brainbench.com