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

35/100 and 5/100 are proportional right?
2 (x+1)=3x-1 how to do this
The graph represents part of Brooke's trip to work. During what time period is her speed increasing? A) between 0 and 10 minutes B) between 20 and 25 minute
In this region of Oceania, Australasia, and Antarctica, what are some reasons native species face extinction? mining MO
The safest type of stretching for beginners to start with is
How do human beings contribute to the phosphorus and sulfur cycles?
Given the equation 2x + 5y = 5, answer the following questions. (a) Is the slope of the line described by this equation positive or negative? (b) As x incr
Which era in music history is characterized by extremes and emotion?
Cesar Chavez’s background included which of the following? His parents were business owners. He was once a college student. He was once a community organizer. H
how does the way water changes from one state to anoatehr compare to the way other substances change ?