Help with PrintWriter code in JAVA

I'm creating a file which contained the field name, student ID, house phone number, mobile number and address. Sometimes people don't enter the house phone number. However, in the file I created still print out the house phone number without any data. How do I get rid of this field when people don't put the house phone number? I mean when people don't enter the datat, I don't want it to be appeared in the file. How do I make it?

Well, you create the file - detect when someone's not put a phone number in and then don't print it out.

Unless you're more specific (a short example might help to clarify) there's not much more help anyone can give you.