zoukankan      html  css  js  c++  java
  • 20151010上午课堂内容

     1         //字符串
     2         
     3         String str = "a";
     4         
     5          char c = 'd';
     6         
     7          int j = 0;
     8          
     9          String strl = new String("a bc bc a bc");
    10          
    11          char[] cc = {'a','b'};
    12          
    13          String str2 = new String(cc);
    14          
    15          System.out.println("str2 = " + str2);
    16          
    17          //连接字符串
    18          
    19          System.out.println("strl + str2 + j = " + strl + str2 + (j + 300));
    20          
    21          //99乘法表
    22          
    23          int[] a = new int[5];
    24          
    25          int l = a.length;//是属性
    26          
    27          int g = strl.length();//是方法
    28          
    29          System.out.println("strl.length() = " + g);
    30                       
    31          //查找
    32          int sy = strl.indexOf("bc");
    33          
    34          System.out.println("strl.indexOf("bc") = " + sy);
    35          
    36          int syl = strl.lastIndexOf("bc");
    37          System.out.println("strl.lastIndexOf("") = " + syl);
    38                  
    39                  //取出字符
    40                  System.out.println("charAt = " + strl.charAt(2));
    41          
    42          //取出字符串
    43          System.out.println("substring = " + strl.substring(3));
    44          
    45          System.out.println("substring = " + strl.substring(3,5));
    字符串
  • 相关阅读:
    python笔记---@classmethod @staticmethod
    python笔记--socket编程
    python笔记--异常处理
    WebStorm 配置
    ECS node 环境搭建
    spm + host
    Untuntu的apt 终端命令
    Ubuntu 添加至启动栏
    Ubuntu设置镜像源
    Ubuntu 设置中文语言环境
  • 原文地址:https://www.cnblogs.com/suqiaoqiao0908/p/4866152.html
Copyright © 2011-2022 走看看