是否会在编写导入时将开销加载到一个包中的所有类型(import java.*); 而不只是一个特定的类型(即import java.lang.ClassLoader)?第二个是比另一个更合适的使用方式吗?
这两个术语之间有什么实质性的区别吗?我知道JDK代表Java Development Kit,它是SDK(软件开发工具包)的一个子集.但是指定Java SDK,它应该与JDK相同.
我们都知道许多抛出的异常对我们的应用程序的性能可能产生的影响,因此,我们应该远离诸如使用控制流的异常之类的东西.在这个声明之后我必须承认,在编码时我并不在乎这个问题.我一直在Java平台上工作,但最近我在.NET平台上做了这个,并且发现了这个方便的方法:public static bool TryParse(string s,out int result)
它允许你将String转换为int而不引发异常.从那一刻起,我就继续使用它.我只想问你关于使用public static bool TryParse(string s,out int result)or的偏好public static int ToInt32(string value).
从Java的角度来看,只是指出它缺少这样一个类似的方法,尽管我们可以通过以下方式得到它:
boolean isInteger = Pattern.matches("^\d*$", myString);
谢谢.
比较下列情况时,我感到很惊讶:
button = document.getElementById("addSugerenciaButton");
if (button != null) {
button.onclick = "post_to_url('" + addSugerenciaURL + "', idBuzon', '" + id + "');";
}
button = document.getElementById("removeBuzonButton");
if (button != null) {
button.onclick = function() {
if (!confirm(removeSugerenciaMessage)) {
return false;
};
post_to_url(removeBuzonURL, 'idBuzon', id);
};
}
button = document.getElementById("editBuzonButton");
if (button != null) {
button.setAttribute("onclick","post_to_url('" + editBuzonURL + "', 'idBuzon', '" + id + "');");
}
Run Code Online (Sandbox Code Playgroud)
只是后者似乎改变了HTML(至少用Firebug进行检查),其余的虽然也正常工作,但他们没有在editBuzonButton元素中显示任何onclick事件.
任何想法为什么会这样?
java ×3
c# ×1
exception ×1
import ×1
javascript ×1
onclick ×1
overhead ×1
performance ×1
sdk ×1
setattribute ×1
tryparse ×1