Vote count:
0
I am having trouble comparing the correct answer with the user inputted answer.
import java.io.*;
import static java.lang.System.*;
import java.util.Scanner;
import java.lang.Math;
class frenchstudyguide
public static void main (String str[]) throws IOException {
//Declarations and ***** and giggles
int n = 0;
Scanner mine = new Scanner (System.in);
String[] anArray;
String[] answers;
anArray = new String[100];
answers = new String[100];
anArray[0] = "une âme sœur";
answers[0] = "soul mate";
anArray[1] = "des commérages (m.)";
anArray[2] = "un esprit";
anArray[3] = "un mariage";
System.out.println(anArray[n]);
System.out.println("now what does it mean?");
String x = mine.nextLine();
System.out.println("The answer was " + answers[n] );
System.out.println("You said: " + x);
System.out.println(x == answers[n]);
}
}
It always comes out false. Why? Sorry if this question was already answered. I was unable to find it. Best regards, darnoc910. Thx in advance
asked 1 min ago
Array's wont compare correctly in java
Aucun commentaire:
Enregistrer un commentaire