Given the following declaration | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Given the following declaration

char c1 = 'c'; char c2 = '#; String s1 = "Computer Science", s2 = "ment"; int position = 3; What is the output of the s1.indexOf(s2.substring(1,3),8)?

30th Oct 2020, 5:36 PM
Ame
Ame - avatar
3 Answers
+ 1
I did it for you but you have to understand why output is 12. https://code.sololearn.com/cnb1gYTFOY5U/?ref=app
30th Oct 2020, 7:04 PM
HBhZ_C
HBhZ_C - avatar
+ 2
Did you run it yourself...?
30th Oct 2020, 5:38 PM
Roderick Davis
Roderick Davis - avatar
+ 1
12 But what is your doubt.. Mention it clearly.. For only output, check in playground.. Otherwise It gets deleted by Mods..
30th Oct 2020, 7:03 PM
Jayakrishna 🇮🇳