国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

I don't know much about the application of break
phpcn_u11665
phpcn_u11665 2017-07-24 19:45:37
0
1
1159

package dayo4;

import java.util.Random;

public class Arraychouj01 {


public static void main(String[] args) {

// TODO Auto-generated method stub

? ? ? ? Random ss=new Random();

? ? ? ? int s;

? ? ? ? int[]a=new int[6];

? ? ? ? for(int i=0;i<6;i ){

? ? ? ? s=ss.nextInt(7) 1;

? ? ? ? System.out.println(s);

? ? ? ? if(i>0){

? ? ? ? for(int j=0;j<i;j ){

? ? ? ? if(s==a[j]){

? ? ? ? i--;

? ? ? ? break; ? ? ?

? ? ? ? }

? ? ? else{

? ? ? ? a[i]=s;

? ? ? ? break;

? ? ? ? }

? ? ? ? }

? ? ? ? }else{

? ? ? ? a[0]=s;

? ? ? ? }

? ? ? ?

? ? ? ? }?

? ? ? ? for(int z=0;z<6;z ){

? ? ? ? System.out.print(a[z] " ");

? ? ? ? }?

}

}

The code above means to randomly pick a number from 1 to 7 and then pick 6 without duplication. The problem is the break after else; if you add it, it is wrong. If you don’t add it, it is right. In my understanding, break means jumping out of the current loop. Meaning: So when it is found that the number is not repeated, assign a value and then jump out of the loop and go to the next loop. However, if brake is added, duplicate arrays will appear. I don’t know the application of break very well

phpcn_u11665
phpcn_u11665

reply all(1)
nearest

Break only loops to one non-repeating data. break should be removed. Get all unique data

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template