- class practice
- {
- public static void main(String[] args)
- {
- Getmethod.method_get();
- }
- }
- class Getmethod //extends Println
- {
- public static void method_get()
- {
- String str="abcdeakpf";
- //长度
- sop(str.length());
- //根据索引获取字符串;
- sop(str.charAt(4));
- //根据字符获取索引;
- sop(str.indexOf('a',3));//找不到时返回-1;
-
- }
- public static void sop(Object obj)
- {
- System.out.println(obj);
- }
- }
复制代码
是这个
|