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

If 2x+z=2y and 2x+2y+z=20 what is the value of y?
if a pH of water is 5.3 then 4.3 is it 1.0 less acidic 1.0 less basic
Three individuals form a partnership and agree too divide the profits equally. X invest -9,000 , Y invest 7,000, Z invest 4,000. How much less does X receive if
what SI unit would best be used to express the height of your classroom ceiling ?
WHICH EXPRESSION IS EQUIVALENT TO SIN 22 COS 18 + COS 22 SIN 18?
I am a polyhedron. I am a prism. my two bases are hexagon. my two other faces are rectangles.
What is adaptation in animals and plants
Which fossil occurs on the most landmasses? & What does this suggest about when these particular continents broke up?
What is does the phrase foe to ambition.
WHICH EXPRESSION IS EQUIVALENT TO SIN 22 COS 18 + COS 22 SIN 18?