Question: I'm currently studying for an exam and I found a little problem with a basic code I wrote to learn methods (I just started, I'm a newbie). 

The problem here is that I created a method called test which is supposed to do a simple product between an already stated number and another number decided by the user. I had to declare the variable of the user input as another method because it wouldn't work otherwise, so I created it before everything else and gave it value 0. The problem here is that when I use the method "test", the one which should do the product, it uses the value of the variable I stated in the beginning instead of the one that the user decided.

Here's the code:

```
import java.util.*;
import java.io.*;

public class ProvaMetodi {
    public static int numero; //User's input variable
    public static void test(){ //The problematic method
        int paolo = 23;  //I decided to multiply the user's input by this number
        int prodotto = paolo*numero; //Just a product
        System.out.println(prodotto); //Tried this, before it was an int class which 
                                     //returned the int "prodotto" so i could use it in different scenarios.
        }
        public static void main (String args []){
            Scanner gigi = new Scanner(System.in);
            System.out.println("Scrivi un numero e lo moltiplico per 23."); //Just the instructions for the user
            int numero = gigi.nextInt();
            System.out.println("Numero="+numero); //Added this for debugging purposes. The output is the user's input, so it's correct.
            test();  //here's the output, which is always 0.
        }
    }

```

Answer: 
You have two `numero` variables:

1. The first one - `int numero = gigi.nextInt();` - is the local variable inside your `main` method into which you read the user input.
2. The second one is `public static int numero;`. This one is being used by the `test` method, and its value remains `0` by default.

You'd better pass the user input to your `test` method:

```
public static void test(int numero) {
    int paolo = 23;  
    int prodotto = paolo*numero;
    System.out.println(prodotto);                     
}

```

and in `main`:

```
test(numero);

```

You can remove the static variable - `public static int numero;`.
Remove the static int.

You need to pass the input to the `test()` method

So change the method to accept the `int` like so:

```
public static void test(int a){ 

```

And also change what your multiplying by to match the parameter:

```
int prodotto = paolo * a;

```

Then call it in your `main` with the user input:

```
test(numero);  

```