Basically I want the program to stop after I input "no" but even when I enter "no" it continues to output true as a boolean.
Scanner scn = new Scanner(System.in);
String strInp;
int intInp;
do{
int total = 1;
// get an integer input
System.out.print("Enter a Number: ");
intInp = scn.nextInt();
//calculate factorial
for(int x = intInp; x != 1; x--){ total *= x;}
//print output
System.out.printf("the value of %d! is %d%n",intInp,total);
// get a string input
System.out.print("Would you like to calculate another number? ");
strInp = scn.next(); // "no"
System.out.printf("is %s not equal to no? %b%n",strInp,(strInp != "no"));
// output : is no not equal to no? true
}while(strInp != "no");
I've tried using scanner.nextLine() along with a lot of different print statements to debug and try and find the problem myself. I'm assuming it has something to do with the intricacies of the scanner class that I don't fully understand.