+ 2
Help me in code
question is in code as a comment. https://code.sololearn.com/cwGd7bC0oce3/?ref=app
8 Answers
+ 5
i thought it checks if the string contain the names u use in variables
+ 5
only one string u mean one word i think , so u could check if it has a space
+ 4
just change the second if statement with else , and remove the comment condition
+ 4
u read just one string , u use the scanner one time ,what does that code supposed to do??
+ 3
//here is my approach
String[] words=f.split("\\s");
if(words.length > 1) {
System.out.println("NO");
}else{
if(f.contains(a)......){.........
}
}
+ 1
It does not work. I entered 2 Strings and it still outputed yes.
+ 1
It has to check if input contains any of strings that i have declared and it will print yes. but input should contain only one string and not more. if it contains 2 or more, no should be printed.It is practise code so nothing serious.