# Help with PrintWriter code in JAVA

**URL:** <https://community.unix.com/t/help-with-printwriter-code-in-java/273576>\
**Category:** Programming\
**Created:** [September 18, 2010, 3:31am UTC](https://community.unix.com/t/help-with-printwriter-code-in-java/273576 "2010-09-18T03:31:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eel](https://community.unix.com/letter_avatar/eel/32/6_449c533f586939b6e5f246632a46421f.png) [@eel](https://community.unix.com/u/eel)\
**Post date:** [September 18, 2010, 3:31am UTC](https://community.unix.com/t/help-with-printwriter-code-in-java/273576/1 "2010-09-18T03:31:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![JohnGraham](https://community.unix.com/letter_avatar/johngraham/32/6_449c533f586939b6e5f246632a46421f.png) [@JohnGraham](https://community.unix.com/u/JohnGraham)\
**Post date:** [September 18, 2010, 6:42am UTC](https://community.unix.com/t/help-with-printwriter-code-in-java/273576/2 "2010-09-18T06:42:54Z")

</div>

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.
