Try this:
String x = "Hello (Java)";
Matcher m = Pattern.compile("\((.*?)\)").matcher(x);
while (m.find()) {
System.out.println(m.group(1));
}
or
String str = "Hello (Java)";
String answer = str.substring(str.indexOf("(")+1, str.indexOf(")"));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…