zoukankan      html  css  js  c++  java
  • java代码----方法类练习中~~~未领会

    总结:今天我很失败,问了老师继承的问题还是没弄懂。因为,技术宅的能力,我好怕啊。太强了。

    package com.da.ima2;
    
    public class yut {// 使用substring方法//去字符串的子串,取字符串的一部分、、、取得字符串索引为2以后的所有字符串
    	public static void main(String[] args) {
    		String a = "TestField";
    		String m = a.substring(2);
    		System.out.println(m);
    		// 使用toString方法
    		// charAt()方法
    		String s = "abc";
    		char c = s.charAt(1);// /charAt()是按照。索引值获得字符串指定的字符
    		// 规定:字符串中的第一个字符索引值是0,,第一个字符索引值是1.以此类推。
    		System.out.println(c);
    		// comparTo()
    		String s2 = "abc";
    		String s3 = "uoi";
    		int value = s2.compareToIgnoreCase(s3);// 接收的类型是整型
    		System.out.println(value);
    		// compareToIgnoreCase()//忽略字符大小写,进行比较
    		String as = "FfdG";
    		String d = "FfdG";
    		int xx = as.compareToIgnoreCase(d);
    		System.out.println(xx);
    		// /字符串的连接concat
    		String fs = "fasdf";
    		String ds = "ouiodf";
    		String ad = fs.concat(ds);// 这里的接收类型是字符串型
    		System.out.println(ad);
    		// 字符串连接方法 +""
    		String abc = "dfasdf" + "23452";
    		System.out.println(abc);
    		// 字符串变化
    		int ld = 32342;
    		String fw = ld + "";
    		System.out.println(fw);
    		// StringBuffer
    		String dsa = "fasdfa";
    		StringBuffer sd = new StringBuffer(dsa);
    		System.out.println(sd.append("3423"));// append方法里面的是字符串。不是字符。
    		System.out.println(sd.reverse());
    	}
    }
    

      

  • 相关阅读:
    HybridAPP开发框架Ionic+AngularJS+Cordova搭建
    MySQL数据类型DECIMAL用法
    RabbitMQ用户管理
    Linux中Mysql root用户看不到mysql库问题解决方式
    RabbitMQ环境安装
    RabbitMQ简介
    Mysql根据一个基库生成其他库与其不同的库升级脚本
    关于中文乱码的解决方法(URL方式)
    java反射机制
    the jar file rt.jar has no source attachment
  • 原文地址:https://www.cnblogs.com/langlove/p/3436710.html
Copyright © 2011-2022 走看看