hi i have a doubt i did this coding and when i complied it and tried to run the program evenupon giving the correct answer("ritchie") the output i got says answer is wrong.
can anyone tell me what is wrong with the coding
import java.io.*;
class Invent
{
public static void main(String args[])
{
try
{
BufferedReader d = new BufferedReader(new InputStreamReader(System.in));
System.out.print("who is the inventor of c :");
System.out.flush();
String answer = d.readLine();
if(answer != "ritchie")
{
System.out.println("answer is wrong");
}
else
{
System.out.println("answer is correct");
}
}
catch(IOException e)
{
System.out.println("wrong input");
}
}
}