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

Hume argues that these things are fundamental to our daily experience that no sane person could possibly doubt them, yet they are completely without justificati
Draw a line for the axis of symmetry of function f. Also mark the x-intercept(s), y-Intercept, and vertex of the function. f(x)= x^2- 4x-5 + 10- Line 8 6 4 2- -
y+3/5[tex] \geqslant [/tex]y+2/3 +2​
How do people use their bodies and voices to communicate different emotions? What do individual behaviors indicate about their feelings toward one another or th
2-3 personal experience of exploitation as a consumer
in triangle ABC A-B= 15 degree, B-C= 30 degree find A,B,C
What can you do to ensure guest and team member safety?
What is the equivalent of 27/5 in decimal form?
What woman artist has had the greatest impact on the public’s opinion of women in the arts at the turn of the 20th century through her work with the Armory Show
Is the function ƒ(θ) = 2cos( θ) an odd or even function?