quipy
Apr 30th, 2003, 03:57 AM
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?
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?