0
Pls i have a question with user input
import java.util.Scanner; class Main { public static void main(String[] args) { // put your code here Scanner word=new Scanner(System.in); String w=word.nextLine(); String w1=word.nextLine(); String w2=word.next(); System.out.println(w.endsWith("burg")); System.out.println(w1.endsWith("burg")); System.out.println(w2.endsWith("burg")); } } It ought to read Augsburg,Saint Petersburg and Morn..and output true ,true and false...is there another way around it
6 ответов
+ 3
Your question is not clear..
If you have inputs
Augsburg
Saint Petersburg
Morn
Then sure the output will be:
True
True
False
What do you want to achieve??
+ 3
The code seems to be running just fine, what problem exactly are you having? and why the need for "another way around it"?
+ 1
Where's the website? Codewars? Sometimes there are hidden test cases. Show us the link to the quiz.
0
I got the answer
..but the ide I run it keeps saying the answer is incorrect...
Its like a quiz something
0
You are reading input by readLine so should each input in separate line.. So 3 input in 3 lines.. As @sami khan given. How are you giving input..? For which, it is incorrect?
It's working fine for me..
0
Sorry I meant to say the website is for learning Java and this was one of the questions asked after each section... but thanks anyway...I used if statement to get past it
And it was really stressful sha