why is it that when I tried char as input its not printing WORD FOUND.
Code:
import java.io.*;
public class fs
{
public static void main(String args[]) throws IOException
{
String [] datatype = new String[4];//{"boolean","byte","char","double","float","int","long","short"};
String input;
//int i=0;
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter String: ");
input = buff.readLine();
datatype[0]="boolean";
datatype[1]="byte";
datatype[2]="char";
datatype[3]="double";
for(int i=0;i<datatype.length;i++)
{
if(input==datatype[i])
{
System.out.println("WORD FOUND");
i=datatype.length;
}
else
{
System.out.println("WORD NOT FOUND");
}
}
}
}
Comment