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

anology of team? answer this pleasethanks!​
Help fast Use the drop-down menus to select the best answers. is a chain of molecules bound together by a specific chemical reaction. is a type of carbohydrat
Gabriel borrowed some money from his friend in order to help buy a new video game system. Gabriel agreed to pay the friend back some amount every week until his
Conjugate the following verbs in present tense to all the subject pronouns (Yo, tú el/ella, nosotros, uds/ellos), Hablar, bailar, mirar, correr, comer, beber,
que es una red de datos
What is the measure of angle x in the figure shown?
Dallas,Who is the strongest uchiha
Solve −2x − 13 = 8x + 7.
Biodiversity means that all living things are the same. True or False​
Macy's price What does the sofa cost at Ikea? 8. Shahada is looking to purchase a new sofa which costs $680 nt Macy's. At Ikea, she only pays 40% of (a) (b) (c)