比如:
[code="java"]
class Test {
private JButtol button;
private JPanel jpanel;
public Test() {}
}
[/code]
1、button和jpanel有没有必要手动初始化呢?
[code="java"]
private JButton button = null;
private JPanel jpanel = null;
[/code]
而如果初始化为:
[code="java"]
private JButton button = new JButton();
private JPanel jpanel = new JPanel();
[/code]
2、这样会不会在真正使用button和jpanel之前造成资源浪费了?
谢谢