Computer java question. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Computer java question.

String x; // used to store any sentence with multiple words . String y; // used to store a single word string. Write a single line statement using String functions to do : Check whether the string y is present in string x or not.

11th Nov 2020, 6:26 PM
I M J
I M J - avatar
1 Answer
+ 4
boolean tf = "Your string sentence x here".toLowerCase().contains("your word y here".toLowerCase());
11th Nov 2020, 6:37 PM
D_Stark
D_Stark - avatar