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
Can someone help me?
stich3 [128]

Answer:

2nd one

Explanation:

7 0
3 years ago
Read 2 more answers
Sql is an example of a ________ category programming language. 4gl 3gl 5gl 2gl
kicyunya [14]
The answer is Fourth-generation language (4GL).  <span>Sql is an example of a 4GL category programming language.  </span>SQL<span> is considered a Fourth-generation </span>language<span> (</span>4GL), whereas Java and C++ are third-generation languages<span> (3GLs). Fourth-generation </span>languages<span> are programming  </span>languages<span> that are closer to human </span>language<span> than the high-level </span>languages<span>  like Java.</span>
8 0
4 years ago
In the context of the data administration component of a database management system (DBMS), the acronym CRUD stands for _____. G
sdas [7]

Answer:

C.R.U.D stands for Create, Read, Update, Delete.

Explanation:

6 0
3 years ago
Your worksheet contains confidential information in column C; to prevent others who use your worksheet from seeing the data, you
emmainna [20.7K]
To prevent others who use your worksheet from seeing the data you can hide column C
5 0
2 years ago
What lever has resistance between the axis (fulcrum) and the force (effort)?
devlian [24]
Secound Second class levers have the load between the effort and the fulcrum. An example of a second class lever is a wheel-barrow.
5 0
4 years ago
Read 2 more answers
Other questions:
  • An ___ is any person who spends times using technology at home
    10·1 answer
  • What is an activity that can help you enhance the appearance of your computer’s desktop?
    12·2 answers
  • As the operations manager for a supermarket chain, Mai needs to find a telecommunications technology that: enables managers in r
    9·1 answer
  • PLEASE HELP I WILL MARK BRAINIST!!!!!!!!!<br><br><br> What is a rolodex?
    7·1 answer
  • When Russ opened a website on his browser, he saw an error that the site was not compatible with the browser version he was runn
    9·1 answer
  • The information provided in text aids can help us to understand a text’s content before we even read it.
    8·1 answer
  • 2.3.4 CodeHS HTML Word Definitions
    10·1 answer
  • Out-of-order instruction execution can cause problems because a later instruction may depend on the results from an earlier inst
    6·1 answer
  • A section at the top of the page that makes it easy for the recipient to respond to a letter is called a(n
    9·1 answer
  • You should move around and take a rest for 30 minutes every 5 minutes.<br><br>True Or False​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!