易截截图软件、单文件、免安装、纯绿色、仅160KB

用Java代码查看系统默认字符集编码

public class EchoDefaultSystemEncoding
{
    public static void main(String[] args)
    {
           String encoding = System.getProperty("file.encoding");
           System.out.println("Default System Encoding:" + encoding);
    }
}


相关文档:

java 错误代码提示

 //=============================输出奇数
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));
}
}
}
// ......

java 数组操作,从数组a中删除数组b中存在的元素

 //从数组a中删除数组b中存在的元素
 String stra[] = {"g","b","c","h","k"};//原始数组
  String strb[] = {"g","k"};   //移除的元素
  ArrayList list = new ArrayList();
//方法一
  for(int i=0;i<stra.length;i++){
   int n=0;
  ......

Java SWT 窗口居中对齐

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) ......

Java单例模式


 1、饿汉式
  package singleton;
  /**
  * 饿汉式单例
  * @author 蒋明原
  *
  */
  public class HungrySingleton {
  /**jvm保证instance只被初始化一次*/
  private static HungrySingleton instance = new HungrySingleton();
  /**阻止外部使用new实例化对象*/
  private Hun ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号