I'm trying to write a simple bit of code to get a input via BufferedReader and then execute some code within another method.
import java.io.*;
public class main {
public main() {
}
public static String input() {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String out;
try {
out = br.readLine();
return out;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public static void someCode() {
//some code
}
public static void main (String[] args) {
input();
if(input() == "Input") {
someCode();
}
}
}
Thanks :)