In Display 17.7, would it be legal to replace JLabel label1 = new JLabel("First label"); add(label1, BorderLayout.NORTH); JLabel label2 = new JLabel("Second label"); add(label2, BorderLayout.SOUTH);...


In Display 17.7, would it be legal to replace


JLabel label1 = new JLabel("First label");


add(label1, BorderLayout.NORTH);


JLabel label2 = new JLabel("Second label");


add(label2, BorderLayout.SOUTH);


JLabel label3 = new JLabel("Third label");


add(label3, BorderLayout.CENTER);


with the following?


JLabel aLabel = new JLabel("First label");


add(aLabel, BorderLayout.NORTH);


aLabel = new JLabel("Second label");


add(aLabel, BorderLayout.SOUTH);


aLabel = new JLabel("Third label");


add(aLabel, BorderLayout.CENTER);


In other words, can we reuse the variable aLabel or must each label have its


own variable name?



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here