How to use indexOf method in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        String str = "java c go c++ python c#";
        
        int index = str.indexOf('c');
      
        System.out.println(index);
    }
}




/*
run:

5

*/

 



answered Oct 4, 2023 by avibootz

Related questions

...