I am learning programming with Java through a textbook. A programming exercise asks you to:
(Swing common features) Display a frame that contains six labels. Set th
It seems that you have answered the question yourself. Yes you would need references (what you call a variable name) if you there is a requirement to manipulate the labels (change attributes) on event generations. But yes if there is no such requirement, in that case your method of using an Array or List is clean and requires less code writing effort.