public class Test{
public static void main(String[] args) {
String str = new String("abcd.");
if(str.indexOf(".") == -1){
System.out.println("含まれない");
}else{
System.out.println("含まれる位置は"+ str.indexOf("."));
}
}
}
実行結果は以下のようになります。含まれる位置は4