tashaunalewis3682 tashaunalewis3682
  • 01-09-2020
  • Computers and Technology
contestada

can java scanner not take in a negative input?

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 02-09-2020

Answer:

It can take a negative input

Explanation:

When you declare a variable in Java and you get your input via Scanner library; the Scanner library will accept the input irrespective of whether it's negative or not.

Take for instance, the following segment

Scanner input = new Scanner(System.in);

int userinput = input.nextInt()

Irrespective of whether userinput is negative or positive, it'll accept it.

Answer Link

Otras preguntas

Identify the effects of cultural diffusion as positive or negative. PLZ HELP THX -fear or hostility toward other cultures -gaining an understanding of foreign c
Translate equations 9th grade
In parallelogram EFGH the measure of angle F is (3x -10)degrees and the measure of angle G is (5x+22)degrees What is the measure of angle G
why is velocity called vector quantity while speed is a scalar quantity​
Write a sentence or two for the following content. sequencing please help!!!!
How does the Mexican wildlife relate to the economic activities in the area?
what is the subordinating conjunction in the sentence if you find out please let me know​
subtract 7 9/16 - 4 2/4
A theater has 25 rows of chairs. The first row has 18 chairs, second has 22, the third has 26, and so on in total the theater seats ___ people
What is 11/25written as a decimal?