|
-
Apr 30th, 2003, 02:57 AM
#1
Thread Starter
Lively Member
overwriting classes in loops
hey ya'll!
what happens if:
Date d = new Date();
StringTokenizer st = new StringTokenizer();
...both of these lines are in a while loop... what would happen when the loop is passed the second/third etc time?
with variables, if you declare them outside the loop, their values will be overwritten throughout the loop. but what about those two? i don't mind having "d" (in Date) overwritten; it's just that at every pass in the loop, i need to pass different arguments into it. ie.
1st pass: Date d = new Date(2003, 12, 12);
2nd pass: Date d = new Date (2001, 6, 6);
would declaring them in the loop be okay or would i have to do so before the loop? and if the latter is true, how do i pass new arguments into "d" if the constructor line is outside the loop?
eh?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|