In this example we will show the method to find a string in a string in Java.
Source Code
package com.beginner.examples;
public class FindString {
public static void main(String[] args) {
String str = "You 'are' right.";
System.out.println(str.indexOf("are")); // find a string in a string
}
}
Output:
5