Java中的转义字符
\n 换行(\u000a)
\t 水平制表符(\u0009)
\b 空格(\u0008)
\r 回车(\u000d)
\f 换页(\u000c)
\' 单引号(\u0027)
\" 双引号(\u0022)
\\ 反斜杠(\u005c)
\ddd 三位八进制
\udddd 四位十六进制
相关文档:
在JAVA中, 在使用String.split方法分隔字符串时,但要注意有些字符不能直接用的,分隔符如果用到一些特殊字符,比如 "| "
,"*",等否则会出现问题,以前刚用时就因为这个问题而看了半天的代码。
public String[] split(String regex)
Splits this string around matches of the given regular expression.
&nbs ......
在JDK1.5之前,对高质量Java多线程并发程序设计时,为防止程序崩掉等现象的出现,比如使用wait()、notify()和synchronized等,需要考虑性能、死锁、公平性、资源管理以及如何避免线程安全性方面带来的危害等诸多因素,通常会采用一些较为复杂的安全策略,加重了程序员的开发负担。在J ......
Runtime runtime = Runtime.getRuntime();// 开始调用服务端脚本
Process process = runtime.exec("encode.sh /home/tomcat6/kgedata/note_not_encode/ /home/tomcat6/kgedata/note_encode/");
int exitVal = process.waitFor();
System.out.prin ......
1、
PermGen space的全称是Permanent Generation space,是指内存的永久保存区域OutOfMemoryError: PermGen space从表面上看就是内存益出,解决方法也一定是加大内存。说说为什么会内存益出:这一部分用于存放Class和Meta的信息,Class在被 Load的时候被放入PermGen space区域,它和和存放Instance的Heap区域不同,GC(Garba ......
import java.text.DecimalFormat
double a = 2.3659874;
//小数格式化,引号中的0.000表示保留小数点后三位(第四位四舍五入)
DecimalFormat df = new DecimalFormat("0.000");
String num = df.format(a);
System.out.println(num);
输出结果就是 2.366
Java计算时间差
比如:现在是2004-03-26 13:31:40
&nbs ......