zoukankan      html  css  js  c++  java
  • 今天的笔记:2014年6月3日

    1. 日期的默认输出格式为:Tue Jun 03 19:30:08 CST 2014。问题:如果调整输出的格式。
      public static void fun1() {
         Date date = new Date();
         System.out.println(date.toString());
      }
    2. 使用正则表达式分割字符串。前者为错误的方法,后者为正确的方法。总结:split的参数为正则表达式,使用正则表达式时注意[ , ( 等符号,但是“\"”与“"”效果应该是一样的。
      public static void fun2() {
         String str = "0<col["age"]";
         String[] strs = str.split("col[\"");
         System.out.println(Arrays.toString(strs));
      
         for(int i = 1; i < strs.length; i++) {
            str = strs[i].split(""]")[0];
            System.out.println("Element: " + str);
         }
      }
      public static void fun2() {
         String str = "0<col["age"]";
         String[] strs = str.split("col\[\"");
         System.out.println(Arrays.toString(strs));
      
         for(int i = 1; i < strs.length; i++) {
            str = strs[i].split(""\]")[0];
            System.out.println("Element: " + str);
         }
      }
    3. 不同类型的数组在Set中,是不会默认转化的。
      public static void fun3() {
         Set<BigDecimal> set = new HashSet<BigDecimal>();
         set.add(new BigDecimal(9));
         System.out.println(set.contains(9));
         System.out.println(new BigDecimal(9) instanceof Number);
         System.out.println();
            
         Set<Byte> ints = new HashSet<Byte>();
         ints.add((byte)9);
         System.out.println(ints.contains(9));
      }

      结果为:false, true, false。
    
    
    
  • 相关阅读:
    kubernetes构架及组件介绍
    二进制部署k8s
    Git
    Redis sentinel
    redis主从复制
    k8s安装
    基于Jenkins实现可腹部回滚的cicd平台
    Redis基础命令和持久化
    构建自动发现的Docker服务架构
    Redis
  • 原文地址:https://www.cnblogs.com/KuTeng/p/3766380.html
Copyright © 2011-2022 走看看