+ 1

String Array

What are the options can I use to output the index of a string array?

1st Nov 2019, 10:53 PM
Gabriel H
Gabriel H - avatar
1 Answer
+ 1
String str = new String("happy learning on sololearn"); System.out.println(str.indexOf("learning")); // output must be 6. Instead of passing a string you can pass a character also.
1st Nov 2019, 11:36 PM
Avinesh
Avinesh - avatar