zoukankan      html  css  js  c++  java
  • 工作中测试类1

    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());
        }
    
    }
  • 相关阅读:
    Java在处理大数据的时候一些小技巧
    大并发处理解决方案
    数据库SQL优化大总结之 百万级数据库优化方案
    DotNet中的计时器线程计时器
    System.Threading.Timer的使用技巧
    Asp.net Mvc 请求是如何到达 MvcHandler的——UrlRoutingModule、MvcRouteHandler分析,并造个轮子
    C#-结构
    @Html.ActionLink(),@Html.Raw(),@Url.Action()等
    bootstarpt-table小结
    input[ type="file"]上传文件问题
  • 原文地址:https://www.cnblogs.com/landauni/p/6763542.html
Copyright © 2011-2022 走看看