其他分享
首页 > 其他分享> > 一周总结(7)

一周总结(7)

作者:互联网

开发验证码

package  com.itheima.test;

public class test3{

public static void main(string[] args){

char[] chs = char[52];

for(int i=0;i<chs.length;i++){

if(i<25){

char[i]=(char)(97*i);

}else{

char[i]=(char)(65*i-26);

}

}

String result ="";

Random r = new Random();

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

int randomIndex = r.nextInt(chs.length);

result = result + chs[randomIndex];

result = result +number;

System.out.println(result);

}

}

数组元素的复制

package com.itheima.test;

public class test4{

public static void main(string[] args){

int[] arr={1,2,3,4,5};

int[] newArr = new int[arr.length];

for(int i=0;i<arr.length;i++){

newArr[i]=arr[i];

}

for(int i=0;i<newArr.;ength;i++){

System.out.println(newArr[i]);

}

}

}

标签:总结,int,newArr,一周,char,chs,result,public
来源: https://www.cnblogs.com/yetang307/p/16583770.html