I have define a collection like List ids. I am wondering which is better
1) initialize in the declaration
2) initialize int he constructor.
I have define a collection like List ids. I am wondering which is better
1) initialize in the declaration
2) initialize int he constructor.
You should declarate it in the constructor, not only for readability but also for inheritance matters. You might want to inherit another class from that and maybe for that particular new class you would like to overwrite the constructor because it has different parameters.