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

All of the following are TRUE about European settlement in North America during the 1600s EXCEPT: a. England and France were fighting to colonize New Spain. b.
A football is thrown from the stadium. The height of this football can be represented by the polynomial -16t2 +32t + 20, where t is the time in seconds. Find th
Find y Help me please
it is accompanied by a gamelan orchestra in Java and Bali​
$1,800 is 1.4% of what property value
https://youtu.be/dQw4w9WgXcQ →the internet’s national anthem← follow me on ig them1lfundery0urbed
Plz help I’ll mark you
The simplest organizational structure is the _______ structure, in which direct lines of authority extend from the top manager to employees at the lowest level
Why do I feel like a burden to my family like I feel that I can't do anything right please tell me why?
7 dollars is equivalent to what in dimes