I'm fairly new to java, so don't think this is some idiot. Anyways, I've been trying to make a program that can read a certain letter from the console and then decide which operation to use, let's say to add. However, I can't get an If loop to read the variable that decides which operator to use, here is the code, and please help.
import java.util.Scanner;
class Main {
  public static void main(String[] args) {
       Scanner user_input = new Scanner( System.in );
        int number;
        String function;
        System.out.println("What Do You Want to Do? (a to add; s to" + 
       " subrtact; d to divited; m to multiply, and sq to square your nummber.)" );
        function = user_input.next();
        if (function == "sq"){
            System.out.print("Enter your number: ");
            number = user_input.nextInt();
            System.out.print(number * number);
        } else {
            System.out.println("Unidentified Function!");
  }
}
}
(I made the description shorter so that it would fit).
 
     
     
    