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

Calculate the value of one exterior angle in a REGULAR nine sided shape.
what is the unit for electric current.​
Greeks used pots to store
Carrie, Shondra, and Tamika decided to make hand-made invitations for their party. Carrie and Shondra got together on Saturday and made 16 invitations altogethe
W hich value of x is in the solution set of the following inequality-x + 8 > 641512​
Which of the following was Percy Shelley's inspiration for "Ode to the West Wind"? a thunderstorm a hurricane a blizzard none of these
What is sanchos attitude toward sternes writing in this excerpt
How do i solve -6(4/3y-2)+8y=12
A student attempted to generate an equivalent expression using the distributive property, as shown below: 5(x − 1) = 5x − 1 What was the mistake made? 5 was
Although many types of bacteria are helpful and do not cause disease nearly half of all human diseases are bacterial