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

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

隨機(jī)字符串

import java.util.ArrayList;

import java.util.Collections;

import java.util.List;

import java.util.Random;


public class aa {

public String sourse="qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0123456789";

public void testSort2(){

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

Random random = new Random();

for(int i=0;i<10;i++){

String str="";

do{

str= "";

int a=random.nextInt(9)+1;

for(int j=0;j<a;j++){

char cr=sourse.charAt(random.nextInt(sourse.length()-1));

? ? ? ? ? ? ? ? ? ?str+=cr;}

}while (stringList.contains(str));

stringList.add(str);

System.out.println("成功添加字符串:"+str);}

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

for(String string:stringList){

System.out.println(":"+string);

}

Collections.sort(stringList);

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

for(String string:stringList){

System.out.println("元素:"+string);

}

}



public static void main(String[] args) {

// TODO 自動(dòng)生成的方法存根

aa c= new aa();

c.testSort2();

}


}


正在回答

2 回答

能運(yùn)行,沒問題。

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

liu4444 提問者

非常感謝!
2016-01-13 回復(fù) 有任何疑惑可以回復(fù)我~

nt a=random.nextInt(9)+1;這是什么意思?。?/p>

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

香飄飄丶

隨機(jī)生成1-10個(gè)整形
2016-06-15 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

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

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

進(jìn)入課程

隨機(jī)字符串

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

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

幫助反饋 APP下載

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

公眾號(hào)

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