// 1
String classPath = "java.lang.String";
System.out.println("--->" + classPath.replaceAll("\\.", "/"));
// 2
StringBuffer buf = new StringBuffer();
switch (1) {
case 1:
buf.append("Hello a");
case 2:
buf.append("b");
case 3:
buf.append("c");
default:
buf.append("d");
}
System.out.println(buf.toString());
// 3
int j = 0;
for (int i = 0; i < 100; i++) {
j = j++;
}
System.out.println(j);
// 4
try {
System.out.println("Hello world");
System.exit(0);
} finally {
System.out.println("Goodbye world");
}
// 5
Calendar cal = Calendar.getInstance();
cal.set(2010, 07, 03); // Year, Month, Day
System.out.print(cal.get(Calendar.YEAR) + " ");
Date d = cal.getTime();
System.out.println("---->" + d.getDay());