Why the if statements are not working what is wrong with my code please help me to find out the bug(solved)
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter a number: "); int num = sc.nextInt(); System.out.print("Enter next number: "); int num1 = sc.nextInt(); System.out.print("Enter operator: "); String operator=sc.next(); int sum = num + num1; int diff = num - num1; int mul = num * num1; int div = num / num1; if (operator=="+") { System.out.println("sum of numbers=" + sum); } else if (operator=="-") { System.out.println("The difference of numbers= " + diff); } else if (operator=="Ă") { System.out.println("the product= " + mul); } else if (operator=="Ă·") { System.out.println("the division= " + div); } else{ System.out.println("invalid operator"); } } }