Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to receive integer variables with scanner in java
How to receive integer variables with scanner in java
Usage: num is the received value.

Scanner? sc? =? New? Scanner (system. in);

System.out.println ("Enter integer:");

int? num? =? sc . nextint(); If you want to enter more than one, just add a loop:

Scanner? sc? =? New? Scanner (system. in);

For (...) {

System.out.println ("Enter integer:");

int? num? =? sc . nextint();

}