JAVA How do you put a global variable into a function parameter?
<p>I'm attempting to practice classes methods since I'm very new to JAVA. In my full program I am using other global variables and they are working fine within my other methods. My question is how do i get the public String y to work inside the parameters of my isNum() method so that inside any method I can use isNum(y);  The way it is now the String y is only within the scope of isNum but I want y to be global inside the paramters of isNum and within it. Simple answers as possible thank you so much.</p>

<pre><code>public static String y;
public static boolean isNum(String y){

for(int i = 0; i &lt; y.length(); i++){

if(!(y.charAt(i) &gt;= 48 &amp;&amp; y.charAt(i) &lt;= 57)){

    return false;
    }
}

return true;

} 
</code></pre>

<p>I want to use isNum in this loop and transfer the value of x into y.
I know x is an int and y is a string. How would I make that work?</p>

<pre><code>        x = input.nextInt();

        if(isNum(y){
        while(x &lt;=0 || x &gt; 3){
             System.out.println("Choose a correct gear number: ");

             x = input.nextInt();
        }
        switch(x){
            case 1:
            System.out.println("You're in Gear 1");
                break;
            case 2:
            System.out.println("Gear 2");
                break;

            case 3:
            System.out.println("Gear3");
        }
      }

    }
</code></pre>