StringBuffer.indexOf(String str) has the following syntax.
public int indexOf(String str)
In the following code shows how to use StringBuffer.indexOf(String str) method.
public class Main{ public static void main(String args[]) { StringBuffer sb = new StringBuffer(); sb.append("java2s.com"); int index = sb.indexOf("a"); System.out.println(index); } }
The code above generates the following result.