Java示例Word的最后索引 Java示例查找Word出现次数 Java示例字符串中特定单词的最后索引 Java示例Word的最后索引 import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String args[]) { String candidateString = "This is a Java example.This is another Java example."; Pattern p = Pattern.compile("Java"); Matcher matcher = p.matcher(candidateString); matcher.find(); int nextIndex = matcher.end(); System.out.print("The last index of Java is:"); System.out.println(nextIndex); } } Java示例查找Word出现次数 Java示例字符串中特定单词的最后索引