construction.java~51~

来自「提供了常用的JAVA技术的示例」· JAVA~51~ 代码 · 共 28 行

JAVA~51~
28
字号
package Construction;public class Construction {  public static void main(String a[]){    char chars1[]={'a','b','c'};    char chars2[]={'e','f','g','h','j'};    byte ascii[]={120,121,122};    String s1=new String(chars1);    String s2=new String(chars2,0,5);    String s3=new String(ascii,0,3);    String s4="helloworldwell !";    String s5="w";    System.out.println("String s1="+s1);    System.out.println("String s2="+s2);    System.out.println("String s3="+s3);    System.out.println("String s4="+" \" "+s4+" \" ");    System.out.println("s4.length="+s4.length());    System.out.println(s4.charAt(0));    System.out.println("s4.indexOf(100)="+s4.indexOf(100));    System.out.println("s4.indexOf(w,7)="+s4.indexOf("w",7));    System.out.println("s4.lastindexOf(world)="+s4.lastIndexOf("world"));    System.out.println();  }}

⌨️ 快捷键说明

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