Wednesday 18 June 2014

lastIndexOf (int ch)

public int lastIndexOf(int ch)
Returns the index within this string of the last occurrence of the specified character.

class StringLastIndexOf{
 public static void main(String args[]){
  String s1 = "wxyzabdabdda";
  
  System.out.print("Last index of d is : ");
  System.out.println(s1.lastIndexOf('d'));
 }
}

Output
Last index of d is : 10


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment