Why can't I use the string "input" in the method "ifs"?
so I was trying to tidy up the main method, and tried to move the if statements to another method but it says can't find symbol symbol: variable input location class engine.
I'm new to coding so please respond with lots of easily understandable details. Thx
Code:
import java.util.Scanner;
public class engine
{
public static void main(String[] args)
{
String input;
Printer("Would you like to go Left or Right?");
Scanner Keyboard = new Scanner(System.in);
input = Keyboard.nextLine();
//ifs();
}
public static void Printer(String a){
System.out.println(a);
}
public static void ifs(){
if(input.equals ("Left")){
Left();
}
if(input.equals ("left")){
Left();
}
}
public static void Left(){
System.out.println("working");
}
}