Below is my code for a "Do-While" loop. I can't figure out why it's terminating before I even get to enter in the value for my variable "redo" at the end of the do {} section. It terminates right after printing the "would you like to do this again" part.
import java.util.Scanner;
public class AlgWorkbench0402 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String redo;
do {
System.out.println("Enter in two integers and get the sum.");
int val1, val2;
val1 = Integer.valueOf(scanner.nextInt());
val2 = Integer.valueOf(scanner.nextInt());
System.out.println(val1 + val2);
System.out.println("Would you like to do this again? [y/n]");
redo = scanner.nextLine();
}
while (redo == "y" || redo == "Y");
}
}