So I was wondering if someone could show me how I can call/reference a variable from one method into another method. For example,

```
public static void main(String[] args) 
{
    System.out.println("Welcome to the game of sticks!");
    playerNames();
    coinToss();
}

public static void playerNames()
{
    Scanner input = new Scanner(System.in);
    System.out.println();

    System.out.print("Enter player 1's name: ");
    String p1 = input.nextLine();

    System.out.print("Enter player 2's name: ");
    String p2 = input.nextLine();

    System.out.println();
    System.out.println("Welcome, " + p1 + " and " + p2 + ".");
}

public static void coinToss()
{
    System.out.println("A coin toss will decide who goes first:");
    System.out.println();
    Random rand = new Random();
    int result = rand.nextInt(2);
    result = rand.nextInt(2);
    if(result == 0)
    {
        System.out.println(p1 + " goes first!");
    }
    else
    {
        System.out.println(p2 + " goes first!");
    }           
}

```

I want to use p1 and p2 from playerNames() inside of coinToss() so I can simply announce who goes first, but I just can't figure out how to call the variables.

My question is not really different compared to others, however I was unable to understand the answers others were given. Once I posted this I got the answer from a bunch of kind people :)