I don't understand why the program doesn't come out of the loop even after the value of variable YoN is entered as "N".
Output:
code:
import java.util.Scanner;
public class JavaLessonFour{
static Scanner s = new Scanner(System.in);
public static void main(String[] args) {
String YoN = "Y";
while(YoN != "N")
{
System.out.println("inside");
YoN = s.next();
}
}
}