HelloString

■コード

package hello.java.lang;

public class HelloString {

public static void main(String[] args) {

String s = "abc";

System.out.println("s=" + s);

System.out.println("s.charAt(2)=" + s.charAt(2));

System.out.println("s.indexOf('b')=" + s.indexOf('b'));

System.out.println("s.length()=" + s.length());

System.out.println("s.contains(\"c\")=" + s.contains("c"));

}

}

■実行結果

s=abc

s.charAt(2)=c

s.indexOf('b')=1

s.length()=3

s.contains("c")=true