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 are the coordinates of the point is 1/4 of the way from A (-6, -3) to B (6, 1)? A. (-3, -2) B. (0, -2) C. (-1, 0) D. (3, 2)
Which pair of words most accurately describes how Atticus is characterized in To Kill a Mockingbird? moral and excitable calm and disinterested weary and wry wi
What fraction of one year is 8 months
what type of lipids are found in all biological membranes?
Read the excerpt from Act I of The Importance of Being Earnest. Lane. I attribute it to the superior quality of the wine, sir. I have often observed that in mar
3. What was the government’s target population (goal) for 2000?
what is the missing constant term in the perfect square that starts with x^2 -20x
If x + 10 = 70, what is x? A. 40 B. 50 C. 60 D. 70 E. 80
What is the common difference in the following arithmetic sequence 7,3,-1,-5
Is the open sentence 5x-2=3x+2 true when x=2? Justify your answer.