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 the value of x
explain the relationship between a cell size and its surface area
Research in different cultural contexts reveals that obesity is
Give the first four nonzero terms of the series about x=8 representing the function x^(1/3)
What is ralph more concerned about, smoke or fire?
Problem Mitchell is a big coffee fan, so he always takes care of coffee brewing at the office. Normally he uses 100 grams of Robusta coffee to prepare 10 cups
I'm offering 10 points, only answer if you're smart
Which of the following does not describe plants? A.)Eukaryotic B.)Non-motile C.) Heterotrophic D.)Photosynthetic E.)Cell wall made of cellulose
Why Europeans and native Americans became enemies?
what connotation do glared and gulped have