hi all i need a hand with my home work im mad stuck..he he he here is my problem what dose JTextField return when nothing is entered in to the text feild and how would i go a bout checking for a null in the text feild... this is what I tried JTextField emp = new JTextField(20); if(emp.getText()==null){ do this }else{ do this } i did a System.out.println(emp.getText()); and it dumps a space in the console Plz Help Thankz
check also the length of the string that is returned:
if you also want to check whether the string consists only of whitespace, you will have to use either regular expression or iterate over the string. e.g.: