hi guys... i tried to create a simple program. The main method is supposed to call out the secondary method to use Scanner in order to ask a person to type in a number, which will be assigned to int x. Then the secondary method supposed to return the int x to main method, which supposed to print it out. And for some reason I just can't do it. No matter what the main method refusing to accept the int x. What am i doing wrong?
import java.util.Scanner; public class Return{ static Scanner newNum= new Scanner(System.in); public static void main(String[] args){ getInt(); System.out.println(x); } public static getInt( ) { // TODO Auto-generated method stub int x; System.out.print("give a num"); x= newNum.nextInt(); return x; }}