I do realize that this is ugly code but i cant seem to have this program output "Your old". I dont know why my if statement is not working.
Thanks
/*
This class is to be used as new readline method
*/
import java.io.*;
class ReadInput
{
public static void main(String[] args)
{
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(reader);
ReadInput r = new ReadInput();
try{
r.readline(in);
}
catch (IOException e)
{
System.out.print("\n Exception caught \n");
}
}
public void readline(BufferedReader b)throws IOException
{
String input ="sixty";
//Buffer is empty at the moment
while(true)
{
System.out.print("Please enter your age: ");
input = b.readLine();
// else
System.out.println(input);
if (input == "sixty")
{
System.out.println("Your old");
}
else
{
System.out.println("eh");
}
}
}
}