Delete file on java

Delete file on Java:

package com.yamicode.file.utils;

import java.io.File;

@Component
public class FilesUtil {

  private static final String path=File.separator+"yamicode"+File.separator;

  public static boolean deleteFile(String name){
    String url = path+name;
    File fileToDelete = new File(url);
    if(fileToDelete.exists()) {
      return fileToDelete.delete();
    }
    return false;
  }
}