if (!fileName.endsWith(".exe")) {
throw new IOException("文件后缀名不对");
}
if (!fileName.equals("C:\abc.exe")) {
throw new FileNotFoundException("文件名称不对");
}
以上代码两条if语句都没问题
if (!fileName.equals("C:\abc.exe")) {
throw new FileNotFoundException("文件名称不对");
}
if (!fileName.endsWith(".exe")) {
throw new IOException("文件后缀名不对");
}
以上代码第二条if判断语句总为true
这是为什么呢?