Here you can find the source of touch(final File f)
public static final void touch(final File f) throws java.io.FileNotFoundException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.PrintWriter; public class Main { public static final void touch(final File f) throws java.io.FileNotFoundException { PrintWriter writer = new PrintWriter(f); writer.println("x"); writer.flush();//from w w w. ja va 2 s. c o m writer.close(); } }