Answer the question
In order to leave comments, you need to log in
Guys just starting to delve into programming, what am I doing wrong in this code?
I need to fill an array of 15 elements with random numbers, what am I doing wrong here? Why is the array filled in order from 0 to 15?
packagecom.company;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int[] mas =new int[15];
Random rand = new Random();
for (int i = 0; i < mas.length; i++) {
mas[i] = rand.nextInt();
System.out.println(i);
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question