21st Apr 2019, 9:46 PM
Lucky Dimas Yedija
Lucky Dimas Yedija - avatar
2 Réponses
+ 3
The variable userInput is a Scanner and only accept Scanner methods to be used. In your code you are using String methods in a Scanner variable. // Problematic piece of code userInput.toLowerCase().contains(example) If you pass the value of Scanner to a String and use the methods correctely you are good to go.
21st Apr 2019, 9:56 PM
Anya
Anya - avatar
+ 1
You need to store the input in a variable to use it. Of type String in your case. The problematic lines fixed (9-12): Scanner userInput = new Scanner(System.in); String input = userInput.nextLine(); System.out.println("Ketikkan kata/kalimat: " + input); if(input.toLowerCase().contains(kataTertentu.toLowerCase()))
21st Apr 2019, 10:13 PM
{ 𝄋 ℒ 𝄋 }
{ 𝄋 ℒ 𝄋 } - avatar