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

Which of these is the most "ominous"? a distant, but serious, storm the sun rising over a new day a bird flapping its wings a person singing in the shower
Someone pls help me I will make you brain
Plz help I need help
PLZ HELP ITS DUE TODAY ILL GIVE YOU 25 points if it’s answered correctly The words to match it with are . Predicate nominative . Indirect object . Object of a
Which scenario is the best example of irony? A. An alleged cure for the common cold gives people the flu. B. Weddings cost a lot of money and are often full of
Explain where scientists think Earth's water may have come from.
8-(-4)+33÷(-3) what is the answer
Convert 301 to base 5
what level of protein structure is associated with the sequence of amino acids
anyone tryna talk im js procrastinating on my work- so ion have nun to do