In java, Using a conditional expression, write a statement thatincrements numUsers if updateDirection is 1, otherwise decrementsnumUsers. Ex: if numUsers is 8 and updateDirection is 1, numUsersbecomes 9; if updateDirection is 0, numUsers becomes 7. Hint: Startwith “numUsers = …”. Using a conditional expression, write astatement that increments numUsers if updateDirection is 1,otherwise decrements numUsers. Ex: if numUsers is 8 andupdateDirection is 1, numUsers becomes 9; if updateDirection is 0,numUsers becomes 7. Hint: Start with “numUsers = …”.
import java.util.Scanner;
public class UpdateNumberOfUsers {
public static void main (String [] args) {
int numUsers;
int updateDirection;
numUsers = 8;
updateDirection = 1;