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

Write a system of equations with a solution (4,–3)
5x+4y+100 in slope intercept form
Write a system of equations with a solution (4,–3)
Why was is difficult for the Arab people to form one nation?
Which of the following statements is true concerning LUCA? (1) LUCA was a cell. (2) All life on Earth evolved from LUCA. (3) LUCA probably existed probably arou
Which of the following statements is true concerning LUCA? (1) LUCA was a cell. (2) All life on Earth evolved from LUCA. (3) LUCA probably existed probably arou
What are the 3 features of a typical seigneurie
How do scientists use seismic waves to determine the interior structure of Earth?
What is biogeography and what does it provide?
Determine whether the sequence coverage or diverges. If it converges, give the limit. 48, 8, 4/3, 2/9, ...