For example, one of our declarations of BufferedReader in the
discussion of input looked like this:
private static BufferedReader in;
That way, in could be used in main( ), and also in any other method we wrote in the class containing the main( ) method:
import java.io.*;
class Test {
public static BufferedReader in;
public static void main (String[] args) throws IOException {
in = new BufferedReader (new InputStreamReader(System.in));
String line = in.readLine();
otherMethod();
}
private static otherMethod() throws IOException {
String line = in.readLine();
}
}