ITPub博客

首页 > IT职业 > IT图书 > 详细注释,Java入门第三季6-5的左右

详细注释,Java入门第三季6-5的左右

IT图书 作者:maggiefengyu 时间:2021-09-09 09:01:27 0 删除 编辑
//定义一个String泛型的List并在构造函数中初始化它。
public class CollectionsTest {
    ListstringList;
    ListstudentList;

    public CollectionsTest(){
        this.stringList =new ArrayList();
        this.studentList = new ArrayList();
    }
//在此方法内完成随机生成10条10以内长度的字符串,并重新排序。
public void testStringList(){
        Random rd = new Random();
        String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl"
                + "mnopqrstuvwxyz0123456789";//索引位置0~61。

        String sb2=null;//创建一个空字符串用来接收转换后的StringBuilder类型的字符串

        for(int i = 0;i
//主函数。
public static void main(String[] args) {
        // TODO Auto-generated method stub
    CollectionsTest ct = new CollectionsTest();
    ct.testStringList();

//运行后的结果。
图片描述

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/925/viewspace-2798717/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-15

  • 博文量
    68
  • 访问量
    581