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

What cause a decrease in the rate of protein digestion?
Which air mass often originates as a different air mass in siberia and is subsequently altered?
How did rutherford's experiment show that thomson's plum pudding model was incorrect?
what was one reason of why the colony of new york had diverse population
What kind of force was the catholic church in europe during the middle ages?
Why is it important to keep your password safe??
Why did president eisenhower want to use covert operations to combat the spread of communism?
Choose the sentence with the correct use of a colon. Question 14 options: We visited multiple states on our trip; Tennessee, South Carolina, and North Carolina.
What were effects of the major conferences of world war ii.?
If the the length of a rectangle is 5cm longer than twice the length of the width and the area if the rectangle is 403 square centimeters,what is the width?