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
Andrew [12]
3 years ago
7

. Write Java statements to instantiate a random number generator object and generate a random integer between 100 and 250 (inclu

sive).
Computers and Technology
1 answer:
Umnica [9.8K]3 years ago
6 0

Answer:

//import Random package

import java.util.Random;

class Main

{

public static void main (String[] args) throws java.lang.Exception

{

   try{

    /* create an object of Random class. this will generate random number

    in a given range. */

       Random rand = new Random();

       // create two variables and assign 100 and 250 to

       int l = 100;

       int h = 250;

       //generate the random number between 100 & 250 (inclusive)

       int ran_num = rand.nextInt((h+1)-l) + l;

       System.out.println("random number is: "+ran_num);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Import "import java.util.Random" package.In this package, Random class exist. With the help of this class's object, we can generate a random number between a given range.Here we have to generate a random number between 100 to 250(inclusive). So "(h+1)-l" will be 151 and the number generate is in the range of 0-150. if we  add 100 to it, then random number will be in range of 100 to 250.

Output:

random number is: 158

You might be interested in
Fill in the blank with the correct response. Wanting to become a better archer is a what?
Oksi-84 [34.3K]
Is a better archer shooter
5 0
3 years ago
Critics of media consumption :
Virty [35]
A media should not be done away with all together
7 0
3 years ago
What steps can be used to open the Custom AutoFilter dialog box? Select any cell in the data range.
noname [10]

Answer:

Data

Sort and Filter

Text Filters

Explanation:

Proof that this answer is correct in the file attached.

6 0
3 years ago
im past 1000 pts and it still hasnt up my rank from VIRTUOSO to EXPERT can someone explain and yes i have brainly plus
FromTheMoon [43]

Answer:

GREAT!

Explanation:

give me crown please

6 0
3 years ago
Read 2 more answers
Where is the third vanishing point in the three point perspective
Naya [18.7K]

Answer:

The third vanishing point is placed under or above the horizon line

Explanation:

The third vanishing point in three point perspective is not placed on the horizon line. Instead the third vanishing point is placed under or above the horizon line. Often the bottom vanishing point is placed off of the picture plane.

5 0
3 years ago
Other questions:
  • How do I change my keyboard's debounce time?
    15·2 answers
  • What practices will help you avoid sending out e-mail to the wrong person?
    15·1 answer
  • Which of the following are personal video journal entries posted on the web? Select one: A. Podcasts B. Vlogs C. Blogs D. Newsgr
    14·1 answer
  • Clarisse is setting the white spaces at the edge of her Word document to be 1 inch. She is setting the _____.
    7·1 answer
  • Cpu coolers are typically made using what two different types of materials?
    6·1 answer
  • _____ selectors are used to select elements based on elements that are adjacent to them in the document hierarchy.
    9·1 answer
  • HELP PLEASE!!!
    11·1 answer
  • HLOOKUP is used for Horizontal Data look ups while VLOOKUP is for Vertical Data look ups
    8·1 answer
  • What is an example of new technology having a negative impact on sustainability?.
    6·1 answer
  • You recently discovered that several key files of your antivirus program have been deleted. you suspect that a virus has deleted
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!