I am writing a String to a text file. but null is getting printed

file, java, null, string

Solution

initialize temp to "" instead of null

Problem

I have declared and initialed say a String temp = null; through the program i am changing the value of temp by temp = temp + folders[i] + newline; and then write this String temp to a text file. Now the issue is, every time I write it to the file, the word "NULL" gets printed too. Please suggest me a work around.

Original source