public class TempTest {
private void test1(A a){
}
public static void main(String[] args) {
TempTest t = new TempTest();
A a = new A();
t.test1(a); //这里传递的参数a就是按引用传递
}
}
class b{
public int age = 0;
}
public class TestDate {
/**
* @param args
* @throws ParseException
*/
public static void main(String[] args) throws ParseException {
String dateStr="20101010101010";
SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMddHHmmss");
Date date=sdf.parse(dateStr);
Calendar rightNow=Calendar.getInstance();
rightNow.setTime(date);
rightNow.add(Calendar.DATE, 7);
Date d=rightNow.getTime();
String dStr=sdf.format(d);
System.out.println(dStr);
Date now=new Date();
if(now.after(d)){
System.out.println("OK");
}
}
}
public class TestFunction {
/**
* @param args
*/
public static void main(String[] args) {
TestFunction t=new TestFunction();
A a = new A();
Integer b = null;
Map<String, Integer> map=new HashMap<String, Integer>();
map.put("b", b);
t.test3(map);
t.test1(a);
System.out.println(a.aa);
System.out.println(map.get("b"));
}
private void test1(A a){
test2(a);
}
private void test2(A a){
a.aa=111;
}
private void test3(Map<String, Integer> map){
test4(map);
}
private void test4(Map<String, Integer> map){
int bb=map.get("b");
bb=2222;
map.put("b", bb);
}
}
class A{
public int aa = 0;
}
public class TestList {
/**
* @param args
*/
public static void main(String[] args) {
List<String> a=new ArrayList<String>();
a.add("1");
a.add("2");
String b=a.remove(0);
System.out.println(b);
}
}
public class RegexMatches {
public static void main(String args[]) {
String str = "Pp000dsaP";
String pattern = "(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{6,25}";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(str);
System.out.println(m.matches());
}
}