当我尝试在eclipse adt插件工具中创建新的android项目时,我遇到了一个问题.
错误/异常::
Errors occurred during the build.
Errors running builder 'Android Resource Manager' on project 'test'.
java.lang.NullPointerException
我以前曾两次遇到过这个问题.唯一的解决方案就是重新安装实际上解决了问题的Windows操作系统.但我想要一个真正的解决方案,而无需重新安装Windows.
public class SimplePrint {
public static void main(String[] args) {
long i = System.currentTimeMillis();
System.out.println(i);
float h = 0.0f;
i -= h;
System.out.println(i);
}
}
Run Code Online (Sandbox Code Playgroud)
输出是:
1477904636902
1477904695296
但是当我改变h变量的数据类型时
public class SimplePrint {
public static void main(String[] args) {
long i = System.currentTimeMillis();
System.out.println(i);
double h = 0.0f;
i -= h;
System.out.println(i);
}
}
Run Code Online (Sandbox Code Playgroud)
输出改变了:
1477904677513
1477904677513
为什么是这样 ???
如果块更好?
private static void checkStr(String str) {
if (str.equals("exit")) {
System.out.println("It is equal");
}
if ("exit".equals(str)) {
System.out.println("It is equal");
}
}
Run Code Online (Sandbox Code Playgroud)