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 is the slope of the line whose equation is 12=4x-6y ?
How are characteristics of imperialism and nationalism related
Are O, N, and P collinear? If so, name the line on which they lie.
The words between ( ) are the answers you can choose Which part of this excerpt from Leo Tolstoy’s The Death of Ivan Ilyich suggests that Gerasim's acceptance o
how can we calculate the slope of a line without graphing it?
1. Solve for x. Show each step of the solution 4.5(8 - x) + 36 = 102 - 2.5(3x + 24)
What fossil was found in Olduvai Gorge in Tanzania
This statement shows that living organism depend on.
What succeeded vladimir lenin and became the leader of the Soviet Union
what property of water results from the high cohesion between water molecules?