This is the program
import java.util.Scanner; //imports class
public class blank2 {
    public static void main(String[] args) {
     Scanner in = new Scanner(System.in);
     boolean valid = true;
     String ans;
     ans = in.next(); //answer is a string
If you type in "y", it goes right to the else statement.
while (valid == true)
{
it always skips this statement
    if (ans == "y")
    {
       System.out.println("it works");
       valid = false;
    {
    else
    {   
       System.out.println("no work");
       valid = false;
    {   
}   
   }
}
It just wont work
 
     
    