Created
April 26, 2026 01:50
-
-
Save bg1bgst333/3d42c928178dc7f3602bcad2af9b8645 to your computer and use it in GitHub Desktop.
String.indexOf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // メインクラス | |
| public class MainClass{ | |
| // Javaのエントリポイント | |
| public static void main(String[] arg){ // mainメソッドの定義 | |
| // 文字列strの定義. | |
| String str = "ABCDE"; | |
| // 指定文字列の位置を取得. | |
| int index = str.indexOf("CD"); | |
| // 出力. | |
| System.out.println(index); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment