'error cannot convert int to boolean in the if else if statement in java [closed]

package Fare;

import java.util.Scanner;

public class fare {

public static void main(String[] args) {
    
    Scanner input = new Scanner(System.in);
    
        System.out.print("          Enter Class         ");
        System.out.println("        a. Senior       b. Student          c. Regular          ");
        System.out.println("Enter class : ");
        int num = input.nextInt();
        
        if (num = 1) {
            double fare = 9 * 0.10;
            System.out.println("Your fare will be " + fare + "▒. Thank you.");
        }
        
        else if (num = 2 ) {
            double fare = 9 * 0.08;
            System.out.println("Your fare will be " + fare + "▒. Thank you.");
        }
        
        else {
            System.out.println("your fare will be 9▒. Thank you.");
        }
}

}

Hi i can't seem to understand why there is an error in my if statement stating that it cannot convert int to boolean. I have already checked it and still can find any problem or mybe i just don't know.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source