【发布时间】:2012-02-16 11:41:38
【问题描述】:
我目前包含以下无法编译的代码。 else if 语句报告“;' expected”。我不明白为什么我不能在这种情况下使用else if?
public class FileConfiguration {
private String checkOs() {
String path = "";
if (System.getProperty("os.name").startsWith("Windows")) {
// includes: Windows 2000, Windows 95, Windows 98, Windows NT, Windows Vista, Windows XP
path = "C://Users//...";
}
elseif (System.getProperty("os.name").startsWith("Mac")) {
path = "///Users//...";
}
return path;
}
// declare paths for file source and destination
String destinationPath = path;
String sourcePath = path;
【问题讨论】:
-
从 C# 的角度来看,
elseif之间需要一个空格,除非它只是一个错字:) -
最近在用 PHP 编程。谢谢
标签: java