Your problem is that you are trying to find a local variable in a separate class. Variables can be set outside of a method like main(), and if they are public variables, they can be easily accessed by another class.
Outside of the main() function, inside the Main class, you would place the numberSearch variable. Then inside Finder you can access numberSearch by getting Main.numberSearch's value.
Be aware that if your professor wants you to use a private variable, you will need to use getters and setters.
/*How I tested the code*/ public class Main { public static int numberSearch; public static void main(String args[]) { int target = (int) (Math.random() * 1000); numberSearch = target; /* some code */Finder.getResult(); } } /*in a separate file*/ public class Finder { public static void getResult() { int someVariablet = Main.numberSearch; /* some code */ System.out.println(t); } }