stringtest.java

来自「c21Examples.rar」· Java 代码 · 共 18 行

JAVA
18
字号
import java.lang.System;
import java.lang.String;

public class StringTest {

    public static void main(String args[]) {

    String s1 = "Teach Yourself C in 21 Days";

    System.out.println("The original string: " + s1);
    System.out.println("Converted to uppercase: " + s1.toUpperCase());
    System.out.println("Converted to lowercase: " + s1.toLowerCase());
    System.out.println("The first Y is at position " + s1.indexOf('Y'));
    System.out.println("Replacing 'e' with '!': "+s1.replace('e', '!'));
    System.out.println("This string has " + s1.length()+" characters.");
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?