TextField里输入为空时,调用getText()方法将返回什么值? 好像既不是"",也不是null我的调试代码:
button.addActionListener(new ActionListener()
{public void actionPerformed(ActionEvent e)
{String text=textField.getText();
if(text==null)System.out.println("啥也没有");
else System.out.println(text);
}
});
button.addActionListener(new ActionListener()
{public void actionPerformed(ActionEvent e)
{String text=textField.getText();
if(text==null)System.out.println("啥也没有");
else System.out.println(text);
}
});
这个串打印出来的是空白。这个串既不是"",又不是null,那是什么?