public static File removeExtension(File file){
  String absolutePath=file.getAbsolutePath();
  if (absolutePath.contains(".")) {
    return new File(absolutePath.substring(0,absolutePath.lastIndexOf('.')));
  }
 else {
    return file;
  }
}

public static File removeExtension ( File file ) { String absolutePath = file . getAbsolutePath ( ) ; if ( absolutePath . contains ( "." ) ) { return new File ( absolutePath . substring ( 0 , absolutePath . lastIndexOf ( '.' ) ) ) ; } else { return file ; } }
remove the last extension of file . if no extension found then return the input file e . g . a . out . log - - > a . out a . diff - - > a
