//摘自ocjp
public void testIfA() {
if (testIfB("True")) {
System.out.println("True");
} else {
System.out.println("Not true");
}
}
public Boolean testIfB(String str) {
return Boolean.valueOf(s...
分类:
编程语言 时间:
2014-09-04 00:16:27
阅读次数:
246
publicclasstest1{ publicstaticvoidmain(String[]args){SimpleDateFormatdf=newSimpleDateFormat("yyyy-MM-dd");//设置日期格式System.out.println(df.format(newDate()));//输出当前时间Calendarc=Calendar.getInstance();//设置日期格式System.out.println(c.getTime());//..
分类:
编程语言 时间:
2014-09-03 13:19:47
阅读次数:
163
1.JSONObject jsonObject = new JSONObject();jsonObject.put("a", "1");jsonObject.put("b", "2");jsonObject.put("c", "3");System.out.println(jsonObject);{...
分类:
编程语言 时间:
2014-09-03 12:46:16
阅读次数:
353
1.用System.currentTimeMillis() 代替new Date().getTime()获得当前时间的毫秒值 public static void main(String[] args) { System.err.println(System.currentTim...
分类:
其他好文 时间:
2014-09-03 09:33:26
阅读次数:
160
import java.util.Scanner;
public class Test1 {
//1,两个变量里的数字进行交换,不依赖第三个变量
int a ;
int b;
public void swap(int a ,int b){
a = a + b;
b = a - b;
a = a - b;
System.out.println("交换后"+"a:"+a+",...
分类:
其他好文 时间:
2014-09-02 21:27:45
阅读次数:
208
重写Activity的onAttachedToWindow 方法@Override public void onAttachedToWindow() { System.out.println("Page01 -->onAttachedToWindow"); this.getWi...
分类:
移动开发 时间:
2014-09-02 17:42:35
阅读次数:
240
Role r = new Role();r.setName("TEST");r.setDescription("123");r.setLevel(2);roleServices.merge(r);System.out.println(r.getId());上面代码执行完以后,r.getId()是nu...
分类:
其他好文 时间:
2014-09-02 15:29:45
阅读次数:
239
1 public class Test { 2 3 public static void main(String[] args) { 4 System.out.println(toBinary(9)); 5 System.out.println(toHe...
分类:
其他好文 时间:
2014-09-02 13:58:54
阅读次数:
121
package com.leetcode;
import java.util.ArrayList;
public class Permutation {
public static void main(String[] args) {
ArrayList res = perms2("abc");
System.out.println(res);
}
//法一:
publ...
分类:
编程语言 时间:
2014-09-01 22:53:04
阅读次数:
268
import java.util.regex.*;
public class TestRegularExpression {
public static void main(String[] args) {
if (args.length < 2) {
System.out.println("Usage:\n" + "java TestRegularExpressi...
分类:
编程语言 时间:
2014-09-01 16:01:53
阅读次数:
183