1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
il63 [147K]
2 years ago
14

Array Basics pls help

Computers and Technology
1 answer:
posledela2 years ago
5 0

Answer:

import java.util.Random;

class Main {

 static int[] createRandomArray(int nrElements) {

   Random rd = new Random();

   int[] arr = new int[nrElements];

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

     arr[i] = rd.nextInt(1000);

   }

   return arr;

 }

 static void printArray(int[] arr) {

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

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

   }

 }

 public static void main(String[] args) {

   int[] arr = createRandomArray(5);

   printArray(arr);

 }

}

Explanation:

I've separated the array creation and print loop into separate class methods. They are marked as static, so you don't have to instantiate an object of this class type.

You might be interested in
Match the feature to its function.
Roman55 [17]

The Matchup of the feature to its function are:

1. Normal view the place where creating and editing occurs .

2. Notes view an area in which information for handouts can be added.  

3. Slide pane the place where the slide order can be changed.

4. Menu bar contains lists of commands used to create presentations  

5. toolbars provide rows of icons to perform different tasks.

<h3>What is the normal view?</h3>

Normal view is known to be the view that is seen or used in editing mode and this is where a person can work a lot of items so that they can create their slides.

Note that Normal view is one that shows slide thumbnails on the left, that is a large window that depicts the current slide, and also has a  section that is often seen below the current slide.

The Matchup of the feature to its function are:

1. Normal view the place where creating and editing occurs .

2. Notes view an area in which information for handouts can be added.  

3. Slide pane the place where the slide order can be changed.

4. Menu bar contains lists of commands used to create presentations  

5. toolbars provide rows of icons to perform different tasks.

Learn more about Normal View from

brainly.com/question/14596820

#SPJ1

6 0
2 years ago
Gross Domestic Product (GDP) is the economic report card for any country. What is the report card measuring?
GalinKa [24]
The answer is production.



6 0
4 years ago
A pointing device used mainly for computer games is known as
kolbaska11 [484]

Answer: Joystick is the only one that makes sense, a stylus and digitizer are both used on drawing tablets, not computer games.

5 0
2 years ago
I’m quitting this thing so I’m giving all my points away which are 218!!! I’m still gonna have more tho just in case I ever need
Sedaia [141]

Answer:

skdjdishsjsbsisjsjsjsjsnssnsjsjsjsjsjsjjskdxkjdsisi

4 0
3 years ago
Read 2 more answers
Who was Naruto's first kiss<br><br>A. Hinata<br>B. Sasuke<br>C. Sakura​
Amanda [17]

His first kiss was Hinata and it was also her first kiss as well mark me as brainliest please

Your answer is A

3 0
3 years ago
Other questions:
  • When do posts on social media networks disappear? A. After 5 years B. Once you've posted enough where it's too far to scroll bac
    5·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    9·2 answers
  • An attacker captures an encrypted message. he tries decrypting with every possible key until the decryption process reveals a se
    14·1 answer
  • why backupdocs.com keeps giving computer system update with regards to pdf documents savings? #backupdocuments
    6·1 answer
  • write a Program which displays at least 5 different sentences that explain how technology has been used to win souls to Christ.
    6·1 answer
  • Does access provide email communication
    13·1 answer
  • Which of the following statements about federal student loans is true?
    7·1 answer
  • Write a for loop that prints the values 1 2 4 8 16 32 64 by increasing the value of a counting variable by a factor of two in ea
    15·1 answer
  • Which item is developed last in the cyclical design process
    11·1 answer
  • A large, closet-sized computer capable of simultaneously processing data for hundreds or thousands of users is most likely a ___
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!