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

Is STM semantically or acoustically encoded??
Which substance will combine with oxygen gas to produce a greenhouse gas? a. Na b. S c. H₂ d. Ne e. C
which expression is equivalent to x^4-y^4?
Is STM semantically or acoustically encoded??
Which of the following oxides can dissolve in water to form a solution that would turn litmus indicator red in color? a. MgO b. K₂O c. CO₂ d. ZnO e. H₂O
Tear is to sorrow as smile is to
Jonathan has been on a diet since January 2013. So far, he has been losing weight at a steady rate. Bases on monthly weigh-ins, his weight, w, can be modeled by
what is the cell cycle??
1,352 pounds is what fraction short of a ton? A) 169/250             B) 77/100               C)13/20             D140/223
do you know how to say my in Spanish?