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

Given the function f(x)=2+8x^2 , calculate the following. f(a)= 2+8a^2 f(a+h)= ?
Carla withdrew $320 every month for four years to help pay for college how much total money did she withdraw
five naturally occuring base​
Is 10x-3=5(2x-4) +17 one solution , many solutions or no solutions
What is the equation of the line parallel to 3x + 5y = 11 that passes through the point (15, 4)?
Which organelle breaks down materials and releases energy into the cell?
if you kick a soccer ball on the ground,it eventually comes to a stop because of the friction with the grass.Which newton's law of motion is this an example of​
The sphere weighs 4 pounds. sorry no picture but you can ask me for it in the comments What is the weight of the cylinder? What is the weight of the cube?
all digits shown on the measuring device, plus one estimated digit. are consided what
the measure of the supplement angle is 24 more than three time the measure of the original angle. find the measures of the angles.