我有以下 Groovy 脚本,我试图在其中获取目录名和文件名:
File dir = new File("C://Users//avidCoder//Project")
log.info dir //Fetching the directory path
String fileName = "Demo_Data" + ".json"
log.info fileName //Fetching the file name
String fullpath = dir + "\\" + fileName
log.info fullpath //Fetching the full path gives error
但是,当我运行它时,出现以下异常:
“java.io.File.plus() 适用于参数类型”
为什么创建fullpath
变量会引发此异常?