15
I read some posts here and I started why some people do
@Override
public Dimension getPreferredSize() {
return new Dimension(500, 500);
}
instead of
setPreferredSize(new Dimension(500, 500));
Isn't the second one better because it creates only one Dimension object whereas the first one possibly creates several (even if it's not that much wasted memory)? Or am I wrong? Is there a difference at all?