Cannot return a value from method whose result type is void error

compiler-errors, java, return

Solution

Simply change `void` to `int` as you're returning an `int`.

public static int move()
{
    System.out.println("What do you want to do?");
    Scanner scan = new Scanner(System.in);
    int userMove = scan.nextInt();
    return userMove;
}

A `void` method means it returns nothing (ie. no return statement), anything other then `void` and a return is required.

Problem

I am trying to take the user input from one method and use it in another. I am confused about the cannot return a value from method whose result type is void error because "userMove" is defined as type int. ``` public static void move() { System.out.println("What do you want to do?"); Scanner scan = new Scanner(System.in); int userMove = scan.nextInt(); return userMove; } public static void usersMove(String playerName, int gesture) { int userMove = move(); if (userMove == -1) { break; } ```

Original source