zoukankan      html  css  js  c++  java
  • 实体类

    一、math类

      ①math常用的方法

      

    package com.bdqn.text;
    
    public class MathTest {
    	public static void main(String[] args) {
    		/**
    		 * Math.sqrt()//计算平方根
    		 * Math.cbrt()//计算立方根
    		 * Math.pow(a,b)//计算a的b次方
    		 *	Math.min(a,b)//计算a,b中的最小值
    		 * Math.max(a,b)//计算a,b中的最大值
    		 * 
    		 */
    		System.out.println(Math.sqrt(4));
    		System.out.println(Math.cbrt(23));
    		System.out.println(Math.pow(1, 10));
    		System.out.println(Math.min(19,12));
    		System.out.println(Math.max(23,32));
    /**
     * abs求绝对值
     */
    		System.out.println(Math.abs(-10.23));//10.23
    		System.out.println(Math.abs(20));//20
    /**
     * ceil天花板的意思,返回大的值
     */
    		System.out.println(Math.ceil(10.23));//11.00
    		System.out.println(Math.ceil(-12.12));//-12
    /**
     * floor地板的意思,就是返回小的值
     */
    		System.out.println(Math.floor(20.3));//20
    		System.out.println(Math.floor(-23.32));//-24.0
    /**
     * 	random 取得一个大于或者等于0.0小于不等于1.0的随机数
     * 
     */
    		System.out.println(Math.random());//0.8
    		System.out.println(Math.random()*2+1);
    /**
     * rint 四舍五入,返回double值
     * 注意0.5的时候会取偶数
     */
    		System.out.println(Math.rint(10.7));//11
    		System.out.println(Math.rint(10.5));//10
    		System.out.println(Math.rint(11.5));//12
    /**
     * round四舍五入,float时返回int值,double返回long
     */
    		System.out.println(Math.round(10.4));//10
    		System.out.println(Math.round(10.9));//11
    		
    		
    		
    	}
    }
    

      二、String 类

     string类的的基本特性:

      string类是final类,也即意味着string类不能被继承,并且它的成员方法都默认为final方法。

      string类是通过char数组来保存字符串的。

      string对象一旦创建就是固定不变了,对string对象的任何改变都不影响到原对象,相关的任何change操作都会生成新的对象。无论是sub,concat还是replace操作都不是原有的字符串上进行的,而是重新生成了一个新的字符串对象。也就是说进行这些操作后,最原始的字符串并没改变。

    发生的发生 

  • 相关阅读:
    JavaScript变量和作用域
    遥感专业词汇
    linux修改文件所属用户和用户组
    当singleton Bean依赖propotype Bean,可以使用在配置Bean添加look-method来解决
    linux中的目录和文件的统计
    linux命令在文件中根据命令查找
    走进ELK原理
    nohub和重定向文件
    HashMap与TreeMap按照key和value排序
    List自定义排序
  • 原文地址:https://www.cnblogs.com/story1/p/8034616.html
Copyright © 2011-2022 走看看