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 is blank verse?
Four equivalent expressions for 100k-25k
which obstacle does not usually face developing countries as they try to grow their economies
What is tooth morphology
Which of the following can occur by conduction? a. transfer of heat from the sun b. transfer of heat through air c. transfer of heat through space d. transf
The beginnings of a tornado a funnel cloud true or false only answer if u know please 100
Which of the following is an example of nonverbal communication? whispering giving feedback asking a question frowning
In a federal system of government (also known as a federation), the local and state governments share power with the central government, though the central gove
What quality best describes Quakers?A.PeacefulB.AngryC.GreedyD.Closeminded
the climate is very cold in the northeast region all year long true or false