-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
learning-java-2825378-03_07b (Code gives incorrect answer even when I type Jupiter) Help #47
Comments
I would shorten the code, but the main issue here is that you used .toLowerCase() on input but choiceTwo points to "Jupiter" not "jupiter". |
import java.util.Scanner;
} //having same issue. not reading the if statement |
//okay the .equals is case sensitive. problem solved import java.util.Scanner;
} |
For me i removed the option .toLowerCase() and moved the scanner to right under the main (not sure if the scanner part helped or not) import java.util.Scanner; public class HelloWorld {
} |
Here the main problem is you converted your input in lower case and the value stored in String first letter is in upper case so to avoid this type of problem we can use here equalsIgnoreCase() function import java.util.Scanner; public class Main { public static void main(String args[]) {
} |
Here, you need not use toLowerCase() method and instead of using equals() method, use equalsIgnoreCase() which checks if two strings are equal or not by ignoring its lower or upper case. import java.util.Scanner; public class Main { public static void main(String args[]) {
} } |
import java.util.Scanner;
public class Main {
}
The text was updated successfully, but these errors were encountered: