[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: programing styles
> [1]
> private void myproc(Vector vect){
> for (i=1; i < vect.size() ; i++){
>
> MyObject obj = (MyObject) vect.elementAt(i);
> int y = obj.getY();
> }
> }
>
> or
> [2]
> private void myproc(Vector vect){
> MyObject obj = null;
> int y= 0;
>
> for (i=1; i < vect.size() ; i++){
>
> obj = (MyObject) vect.elementAt(i);
> y = obj.getY();
> }
> }
As with any question with the "which is best" theme, there probably
is no single right answer.
Personally, I tend to prefer the declarations closer to thier first
use, other things (performance, scoping issues, etc.) being equal,
which would give a "style 1" vote from me in this case.
=====
--
Yahoo IM: michael_s_campbell
__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/