生成指定长度的字符串
发布时间
阅读量:
阅读量
创建对象时,采用独立编写getrandowmstring方法的方式以生成随机字符串,其中字符串形式的字母由(new Random()).nexlnt(10)+""实现获取。
package com.wtcto;
import java.util.*;
public class blogTest{
public static void main(String[]args){
//采用几何list结构,构建list之后还需要接着构建对象
List<CommentShow>commentShows=new ArrayList<>();
for(int i=0;i<5;i++){
//构建对象,单独构建了getrandowmstring方法进行获取随机字符串,字符串型的字母是(new Random()).nexlnt(10)+""
CommentShow commentshow= new CommentShow(getRandomString(5),(new Random()).nextInt(10)+ "","阿胖","2021-11-25");
commentShows.add(commentshow);
全部评论 (0)
还没有任何评论哟~
