- 1、本文档共32页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
第九章.精通常用的java类
BigInteger/BigDecimal java.math包中定义的BigIntegeBigDecimal类型可以分别提供任意长度/精度的整数和浮点数运算功能。 BigInteger类主要方法: * public BigInteger(String val) ?? public static BigInteger valueOf(long val) ?? public BigInteger add(BigInteger val) ?? public BigInteger subtract(BigInteger val) ?? public BigInteger multiply(BigInteger val) ?? public BigInteger divide(BigInteger val) ?? public int compareTo(BigInteger val) ?? public BigInteger remainder(BigInteger val) ?? public BigInteger pow(int exponent) ?? public String toString() NumberFormat/DecimalFormat java.text.NumberFormat/DecimalFormat 提供了将数字格式化为语言环境相关字符串以及逆向解析字符串为数字的功能。 主要方法: * public static final NumberFormat getInstance() public static NumberFormat getInstance(Locale inLocale) public final String format(double number) public static final NumberFormat getCurrencyInstance() public static NumberFormat getCurrencyInstance(Locale inLocale) public static final NumberFormat getPercentInstance() public static NumberFormat getPercentInstance(Locale inLocale) 第九章 精通常用java类 本章目标 java.lang.Object类 字符串相关类型 封装类 日期/时间相关类型 数学相关类型 * Object类 java.lang.Object类是所有Java类的最高层次父类,该类提供了面向对象编程技术的基本机制。 重要方法列表: hashCode()方法 toString()方法 equals()方法 finalize()方法 clone()方法 wait()方法 notify()/notifyAll()方法 * hashCode()方法 * public class QQ{ private int account; public QQ(int account){ this.account = account; } //… } public class TestHashCode{ public static void main(String[] args){ QQ q1 = new QQ(3715500); QQ q2 = new QQ; int handle1 = q1.hashCode(); System.out.println(handle1); System.out.println(Integer.toHexString(handle1)); System.out.println(q1); System.out.println(----------------); System.out.println(q2.hashCode()); } } toString()方法 方法格式:public String toString() { …} 方法功能:以字符串形式返回当前对象的有关信息,在Object类的原始定义中,所返回的是对象所属的类型名称及其哈希码。 当使用System.out.println()方法直接打印输出引用类型变量时,println()方法中会先自动调用其toString()方法,再将所返回的字符串信息输出。 在进行String与其它类型数据的连接操作时,自动调用toString()方法,基本类型数据转换为String类型时,调用了对应封装类的toString()方法。 可以根据需要在用户定义类型中重写toString()方法。 * 重写toString()方法 * p
您可能关注的文档
- 公司部门绩效考核办法精要.pdf
- 企业技术创新绩效评价指标体系研究_陈劲精要.pdf
- 中国银行业协会银团贷款流动资金贷款合同示范文本(第3.0版)精要.pdf
- 中小学优质“微课”资源开发的区域实践与启示精要.pdf
- 学生信息管理信息系统分析与设计精要.pdf
- 毕业论文格式3精要.pdf
- 试验(首件)工程总结报告及样表精要.pdf
- 上海市房屋租赁合同范本精要.pdf
- 北京市固定期限劳动合同范本精要.pdf
- 载体桩施工及验收规程精要.pdf
- 国际标准 IEC 60939-2-2:2004 EN_D Complete filter units for radio interference suppression - Part 2-2: Blank detail specification - Passive filter uits for electromagnetic interference suppression - Filters for which safety tests are required (safety.pdf
- 国际标准 IEC 60670-23:2006 EN-FR Boxes and enclosures for electrical accessories for household and similar fixed electrical installations - Part 23: Particular requirements for floor boxes and enclosures 家用和类似固定电气安装用电器配件的盒子与封闭装置——第23部分:地板箱和封闭装置的要求.pdf
- 国际标准 IEC 60670-23:2006 EN-FR 家用和类似固定电气安装用电器配件的盒子与封闭装置——第23部分:地板箱和封闭装置的要求 Boxes and enclosures for electrical accessories for household and similar fixed electrical installations - Part 23: Particular requirements for floor boxes and enclosures.pdf
- 2024版完整的货物运输合同书.doc
- 2024版无财产的离婚协议书书模板.doc
- 2024版委托融资租赁合同书书.doc
- 2024版汪怡的离婚协议书书.doc
- 2024版委托活动代理服务协议书书.doc
- 2024版挖掘机租赁合同书范本最新.doc
- 2024版退款协议书书.doc
最近下载
- 2022-2023学年湖北省鄂州市七年级下学期期末数学试卷(含答案解析).docx
- 成都市七中育才学校初一新生分班(摸底)语文考试模拟试卷(10套试卷带答案解析).pdf VIP
- 玄隐遗密(含黄帝内经).docx
- 幼儿园区域环境—语言区环境创设(幼儿园环境创设课件).pptx VIP
- 整体租赁底商运营方案(技术方案).docx
- 脑梗塞后遗症病人护理查房ppt课件.pptx
- 【上海市】医疗服务收费标准.pdf
- 灭菌方法和无菌操作.ppt
- 华中农业大学2020-2021学年《植物生理学》期末考试试卷(A卷)含参考答案.docx
- 华中农业大学2021-2022学年《植物生理学》期末考试试卷(A卷)含参考答案.docx
文档评论(0)