用Java代码查看系统默认字符集编码
public class EchoDefaultSystemEncoding
{
public static void main(String[] args)
{
String encoding = System.getProperty("file.encoding");
System.out.println("Default System Encoding:" + encoding);
}
}
相关文档:
//=============================输出奇数
public class OddTest {
public static boolean isOdd(int i){
return i % 2 != 0; //比较 i % 2 == 0;注: -1%2 = -1
}
public static void main(String[] args) {
for(int i = -10; i <= 10; i++) {
System.out.println(isOdd(i));
}
}
}
// ......
1、创建了一个对象后:
(1)没有在适当的地方释放掉
(2)在应该释放的地方没有做释放操作
例如:下面一段程序:
m_progressDlg = ProgressDialog.show(this, getString(R.string.market),getString(R.string.is_visiting), true);
new Thread() {
public v ......
public static void CentreWnd(Shell shell){
int width = shell.getMonitor().getClientArea().width;
int height = shell.getMonitor().getClientArea().height;
int x = shell.getSize().x;
int y = shell.getSize().y;
if (x > width) {
shell.getSize().x = width;
}
if (y > height) ......
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
/**
* 求质数和,
* 如:
* sum(1)=2=2
* sum(2)=2+3=5
* sum(3)=2+3+5=10
* sum(4)=2+3+5+7=17
& ......