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 expression is equivalent to 3 5v ?
Compensatory programs are aimed at helping gifted students fulfill their full potential. Group of answer choices True False
You draw a rectangular picture that is 8.5 inches wide. It is 3 times as long as it is wide. What is the area of the picture?
Consider a buffer made by adding 132.8 g of nac₇h₅o₂ to 300.0 ml of 2.31 m hc₇h₅o₂ (ka = 6.3 x 10⁻⁵) what is the ph of the buffer after 0.750 mol of h⁺ have bee
Given that V=1,3,4,2 and W= 6,4,7,2 then VW is Select one: of O 4 0 1,3,6,7 O 2 0 2,4
Choose the best Spanish translation. Do you need some papers?
You have a sample with a volume of 55.7 mL and a mass of 67.9 g. Will this sample float in water? Why or why not?
Please explain how you got your answer.
the question is in the attachment
what is the value of 350 - 30(-14 + 3.5)