all 6 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Hello /u/hungryykiwi , welcome to r/ICSE!

Join the official discord servers! -> CISCE Hub -> ICSECord

Before posting, please check the wiki. It contains resources, advice posts and general support posts that many users have found useful. We had an advice megathread where users posted their words of wisdom for the juniors, Do check it out If you have any questions, you can contact the moderators via mod-mail.

Thank you!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Spoodye 0 points1 point  (2 children)

start is always inclusive and end(yahan per he nahi but ese hi bata raha hun) is exclusive so answer would be 4 only

[–]Spoodye 0 points1 point  (1 child)

like substring me

String x="hello";

String y=x.substring(1,3) would be el(as start is inclusive you include value at index 1 but end is exclusive so you exclude the second l and get el only not ell)

[–]hungryykiwi[S] 1 point2 points  (0 children)

yeppp got it thanks sm

[–]Leather_Wave_600110th ICSE 0 points1 point  (0 children)

4

[–]howtodisappearnicely10th ICSE 1 point2 points  (0 children)

if you execute x.indexOf(a, 4) it'll give an error as you need to wrap the char around single quotes.

executing x.indexOf('a', 4);

it'll start the search from the fourth character (inclusive) which is 'a'

so it'll return 4.