第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

交作業(yè)嘍。。。。。。。

package com.imooc.collection;

import java.util.ArrayList;

import java.util.Collections;

import java.util.List;

import java.util.Random;

import java.util.Scanner;

public class CollectionsTest?

{

public void testStringSort2()

{

List<String>stringList2=new ArrayList<String>();

String[] str1= {"a","b","c","d","e","f","g","h","i","g","k","m","n","o","p",

"q","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7",

"8","9","0"};

String str=new String();//str存放生成的單個(gè)字符串

for(int i=0;i<10;i++)//外層循環(huán)決定生成十個(gè)隨機(jī)的字符串

{

String str2=new String();//str2存放生成的隨機(jī)字符串

int k;

k=1+(int)(Math.random()*(10+1-1));//生成隨機(jī)字符串的長(zhǎng)度k

for(int j=0;j<k;j++)//內(nèi)層循環(huán)生成一個(gè)隨機(jī)的字符串

{

int z;? ? ? ? ? //在字符串?dāng)?shù)組str1中隨機(jī)選擇字符串str1[z]

z=(int)(Math.random()*35);

str=str1[z];

str2=str2+str;

}

stringList2.add(str2);//將str2傳入stringList2中

}

System.out.println("------------排序前------------");

for (String string : stringList2)?

{

System.out.println("字符串:"+string);

}

Collections.sort(stringList2);

System.out.println("-------------排序后-----------");

for (String string : stringList2)?

{

System.out.println("字符串:"+string);

}

}

public static void main(String[] args)

?{

CollectionsTest ct=new CollectionsTest();

ct.testStringSort2();

}

}


正在回答

舉報(bào)

0/150
提交
取消
Java入門第三季
  • 參與學(xué)習(xí)       409774    人
  • 解答問題       4546    個(gè)

Java中你必須懂得常用技能,不容錯(cuò)過的精彩,快來加入吧

進(jìn)入課程

交作業(yè)嘍。。。。。。。

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)