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

In addition to America's "new" imperialism, how was nationalism being expressed in new ways during the 1890s?
how can you divide 769÷92 in long divideson
Do you think that science is a waste of time?
Trace the history of public law enforcement in the United States across any century.
Which leader's portrait emphasized his devotion and piety to his god? (2 points) a Ashurbanipal b Gudea c Naram-Sin d Sennacherib
Do you think that every substance can be separated physically or chemically into other substances? Explain your answer.HELP ME PLZ!!!I'M CRYING RIGHT NOW!!!
Drag the tiles to the correct boxes to complete the pairs.
Which excerpt from I Never Had It Made best uses descriptive details to paint a picture for readers? O In August 1945, at Comiskey Park in Chicago, I was approa
5. What were the good works Jay Prithvi Bahadur Singh did for Nepali people?
Why is a Quality assurance tester needed on a software development team?