Using object, set the properties first in the Properties object. setProperty(String obj1, String obj2) is a method to change the properties of an object.
Then, by supplying a FileOutputStream to properties object, write it to your File. store(FileOutputStream, String)