Java source code examples

Java source code samples. Java code examples.

Finds out the position of occurrence of String in a StringBuffer

* * * * * 1 votes

Finds out the position of occurrence of String in a StringBuffer

public class StringBufferExample {
	public static void main(String[] args) {
		StringBuffer buff = new StringBuffer("Hello World");
		int value = buff.indexOf("World");

		System.out.println(value);
	}
}

Tags: java.lang

Discuss This Code