【每日日报】第四十天 工具类

1 今天看网课

1)StingBuilder和StringJoiner

 1 package liuer;
 2 import java.util.StringJoiner;
 3 
 4 public class StringBuilderDemo {
 5     public static void main(String[] args){
 6         StringBuilder sb=new StringBuilder();
 7         sb.append(52);
 8         sb.append(1).append("中国");
 9         System.out.println(sb.toString());
10         int[] arr=new int[]{12,24,35,46};
11         StringJoiner sj=new StringJoiner(", ","[","]");
12         for(int x:arr){
13             sj.add(Integer.toString(x));
14         }
15         System.out.println(sj.toString());
16     }
17 }

2)Intege

1 package liuer;
2 
3 public class IntegerDemo {
4     public static void main(String[] args){
5         Integer a=12;
6         System.out.print(a.valueOf(a));
7     }
8 
9 }

3)Math

 1 package liuer;
 2 import java.util.Random;
 3 
 4 public class MathDemo {
 5       public static void main(String[] args){
 6           Random random=new Random();
 7           for(int i=0;i<10;i++){
 8               System.out.println(random.nextInt(10));
 9           }
10       }
11 
12 }

 

2 没什么问题

3 明天继续看网课

posted @ 2020-08-14 23:40  我试试这个昵称好使不  阅读(105)  评论(0编辑  收藏  举报