I want to call a non static method in Main, but thats against coding rules, so now i cant do the things i want. How can i fix this?
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter infix expression: ");
String userInput = input.next();
System.out.println("Summary");
System.out.println("-------");
System.out.println("Infix: " + userInput);
System.out.println("Postfix: " + infixToPostfix(userInput));
System.out.println("Result: " + evalPostfix(infixToPostfix(userInput)));
}
I'm getting the error:
non static method infixToPostfix(java.lang.string) cannot be refranced from a static context
and
non static method evalPostfix(java.lang.string) cannot be refranced from a static context
I need to use them here to get the correct answers printed.