Write a programmer in java to demonstrate indexOf() and lastIndexOf() method?

class StringIndex

{

                public static void main(String arg[])

                {

                                String s="india";

                                System.out.println(s.indexOf('i'));

                                System.out.println(s.lastIndexOf('i'));

                }

}

IndexOf() and lastIndexOf() method.PNG

, , , , , , , ,

Leave a Reply