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 bigger fraction, 5/6 or 6/7
What is the Geocentric theory in your own words?
How do you say I was born in the Philippines in Spanish
At a store , 24 bottles of water and 6 bags of chips costs $23.40. Five bottles of water and two bags of chips cost $6.60. What is the cost of a single bottle o
how could you compare the energy carried in two different longitudinal waves
How did the alliances that formed in Europe after world war 2 form an "iron curtain" as described by Winston Churchill in a 1946 speech?
water in a pan over a radiator evaporates much faster than a water pan in a table ???? i need help ppl
Explain why the railroads were not built in a straight line from east to west.
HOW TO FIND THE MISSING NUMERATOR IN ANY FRACTIONS LIKE 4/8=  ?/4
how do you now 11/33 is a simplest form