About the constructor of JTextField
, the javadoc says:
public JTextField()
Constructs a new
TextField
. A default model is created, the initial string is null, and the number of columns is set to 0.
But when I use this constructor, the method getText()
of JTextField
returns an empty String
, for example:
boolean b = new JTextField().getText().isEmpty(); // returns true.
Why the value returned by getText()
is an empty String
instead of null
?