import java.util.Scanner;
public class orOperator {
public static void main(String args[]) {
System.out.println(" This code is to check you are eligible or not");
Scanner buddha2 = new Scanner(System.in);
System.out.println("Please enter your nationality");
String nationality = buddha2.nextLine();
System.out.println("you are " + nationality);
if (nationality == "indian") {
System.out.println("you are eligible to join the indian army");
} else {
System.out.println("Your are not eligible to join the army");
}
}
}
///the else part is returning answer not the if part// ///the motto is to take the nationality as input and then will be able to get the result out as the nationality ///
Try
When using "==" it checks for the referential equality of two vars meaning if they reference the same object or not.