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
abruzzese [7]
3 years ago
15

In JAVA, answer the following:

Computers and Technology
1 answer:
erica [24]3 years ago
7 0

Answer:

The JAVA program is as follows.

import java.util.Scanner;

public class Program

{

   static int n;

public static void main(String[] args) {

    //scanner object

    Scanner stdin = new Scanner(System.in);

    //loop executes till number entered is in the range of 1 to 10

    do

    {

        System.out.print("Enter any number: ");

        n = stdin.nextInt();

    }while(n<1 || n>10);

    System.out.println("Number is valid. Exiting...");

}

}

OUTPUT

Enter any number: 0

Enter any number: 23

Enter any number: 10

Number is valid. Exiting...

Explanation:

The program is explained.

1. The integer variable, n, is declared static since the variable should be accessible inside main() which is static.

2. An object of Scanner, stdin, is created inside main().

3. Inside do-while loop, the user is asked input any value for n.

4. The loop continues till user inputs a number which is not in the given range, beginning from 1 to 10.

5. The loop will not be terminated till the user enters a valid input.

6. Once a valid input is entered, the message is displayed to the console and the program ends.

7. The variable, n, is declared at the class level and is a class variable. Class variables are declared inside the class but outside all the methods in that class.

8. Since JAVA is a purely object-oriented language, all the code is written inside class.

9. The object of class is not created since only one class is included in the program. If more than one class is included, then the object of the class which does not has the main() method will be created inside main().

10. User input for integer is taken via scanner object and using nextInt() method.

11. The methods, print() and println() display the messages to the console. The only difference is that println() inserts a new line after displaying the message.

12. The name of the class having main() and the name of the program should be the same.

You might be interested in
How is geeking out related to the concept of social capital?
vodka [1.7K]

Answer:

It relates to social relationships and social structures. It involves people knowing each other and having positive relationships based on trust, respect, kindness, ect.

Explanation:

3 0
2 years ago
Which of the following is a way to prevent wastes from contaminating the environment? A) Use absorbent pads to collect floor was
Firlakuza [10]

Answer

Dispose of absorbents as hazardous waste in its own hazardous waste container

Explanation

Hazardous waste is a waste that has chemical composition and properties which makes it capable of causing illness, death  or harm to humans and other life forms when released to the environment without proper management. The characteristics of such wastes include: toxic, ecotoxic, infectious substance, poisonous, explosive and flammability. Hazardous wastes can be destroyed by incineration, chemical process, and temporary on-site waste storage facilities such as waste piles and lagoons/ponds



8 0
3 years ago
Read 2 more answers
What are the correct answers to the following questions?
Lena [83]

Answer:

1. analog sound

2. digital sound

3. pixels

4.  local area network

5.bus

6. slots

Explanation:

4 0
2 years ago
Choose a firewall that is currently on the market and write a technical "sales pitch" to your classmates on why they should choo
stellarik [79]

Answer:

I would propose Comodo Firewall to my schoolmate. It is very easy to understand and have an appealing graphical UI. It gives the most significant level of security from dangers. It checks all the traffic going to the framework and leaving the framework. It quickly cautions you when there is any sort of suspicious action. There are no mind boggling design issues. It learns the conduct of the client to convey customized protection. It gives you the usefulness of Spyware filtering and infection checking in a single tick. There are a lot more functionalities that the firewall gives to its clients.

Explanation:

Choose a firewall that is currently on the market and write a technical "sales pitch" to your classmates on why they should choose the firewall you are selling.

I would propose Comodo Firewall to my schoolmate. It is very easy to understand and have an appealing graphical UI. It gives the most significant level of security from dangers. It checks all the traffic going to the framework and leaving the framework. It quickly cautions you when there is any sort of suspicious action. There are no mind boggling design issues. It learns the conduct of the client to convey customized protection. It gives you the usefulness of Spyware filtering and infection checking in a single tick. There are a lot more functionalities that the firewall gives to its clients.

3 0
3 years ago
I made a fish emoji what do you think &gt;{'_'}&lt; should I change anything
Anvisha [2.4K]

Answer: It is beautiful

Explanation:

3 0
2 years ago
Read 2 more answers
Other questions:
  • Which shortcut brings up the Print screen?
    10·2 answers
  • The ____ dialog box in windows vista appears each time a user attempts to perform an action that can be done only with administr
    12·1 answer
  • When you make a cell phone call, which type of electromagnetic wave is most likely transmitting the signal?
    12·1 answer
  • This is question 2.5 Computer Science and I don't understand what is wrong<br><br>​
    15·1 answer
  • 1. Some of the music in the 1960s was used to protest social and political issues. Is music still used as a form of protest? Why
    13·1 answer
  • Which technology has the potential to be misused to make atomic bombs? A. computer technology B. nuclear technology C. medical t
    14·1 answer
  • Suppose a process in Host C has a UDP socket with port number 6789. Suppose both Host A and Host B each send a UDP segment to Ho
    8·1 answer
  • Miguel owns a tile business. He has two employees who work in a small office. One answers phones and schedules appointments. Ano
    11·2 answers
  • The Yuba College Library would like a program to calculate patron fines for overdue books. Fines are determined as follows: Pape
    15·1 answer
  • How to solve level 53 on rapid router?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!