• 工作中测试类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());
        }
    
    }
  • 相关阅读:
    Tomcat性能调优
    spring 提供的可扩展的接口和类
    Spring boot 定义exit codes 让你定位问题更加简单
    spring中@Async注解的原理和使用
    SpringCache源码深度解析
    ApplicationContextAware和BeanFactoryAware使用理解
    spring aop中引介拦截器的用法
    提高安全性而在HTTP响应头中可以使用的各种响应头字段
    spring aop中targetSource的理解
    PowerMockito使用PowerMockIgnore注解消除类加载器引入的ClassCastException
  • 原文地址:https://www.cnblogs.com/landauni/p/6763542.html
Copyright © 2020-2023  润新知