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

Three liquids are given to you. One is hydrochloric acid; another is sodium hydroxide and third is a sugar solution. How will you identify them? You have only t
Suppose a plane accelerates from rest for 32.3, achieving a takeoff speed of 47.1 m/s after traveling a distance of 607 m down the runway. A smaller plane with
When a mass on a spring is at maximum displacement, what quantity is at a minimum?
Estimate the quotient 1.97 divided by 4
Which of the following statements is not true? Multiple Choice Josquin's compositions strongly influenced other composers, and were praised enthusiastically by
If point C is between points A and B, then AC + ___ =AB A.CA B. AB C.BC D. ABC
Gloria is hard to get to know. Whenever she is put in a situation that might reveal her true personality, she withdraws into a shell, where she feels safe and h
What is 70% of 40,000.
What is the product? (6r-1)(-8r3)
What is the following quotient? 1 divided by 1+ square root 3