java 根据类名示例化类_Java MathContext类| 带示例的getRoundingMode()方法
java 根据类名示例化类
MathContext类的getRoundingMode()方法 (MathContext Class getRoundingMode() method)
getRoundingMode() method is available in java.math package.
getRoundingMode()方法在java.math包中可用。
getRoundingMode() method is used to get the RoundingMode value of this MathContext if defined and there are many constants of Rounding Mode like DOWN, CEILING, UNNECESSARY, FLOOR, etc.
如果已定义,则getRoundingMode()方法用于获取此MathContext的RoundingMode值,并且舍入模式有许多常量,如DOWN,CEILING,UNNECESSARY,FLOOR等。
getRoundingMode() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
getRoundingMode()方法是一种非静态方法,仅可通过类对象访问,如果尝试使用类名访问该方法,则会收到错误消息。
getRoundingMode() method does not throw an exception at the time of getting round mode.
在获取回合模式时, getRoundingMode()方法不会引发异常。
Syntax:
句法:
public RoundingMode getRoundingMode();
Parameter(s):
参数:
None
没有
Return value:
返回值:
The return type of this method is RoundingMode, it returns the RoundingMode constants whatever be defined with this MathContext.
此方法的返回类型为RoundingMode ,无论此MathContext定义什么,它都会返回RoundingMode常量。
Example:
例:
// Java program to demonstrate the example
// of RoundingMode getRoundingMode() method of MathContext
import java.math.*;
public class GetRoundingModeOfMC {public static void main(String args[]) {// Initialize three MathContext objects
MathContext ma_co1 = new MathContext(3, RoundingMode.CEILING);
MathContext ma_co2 = new MathContext(4);
MathContext ma_co3 = new MathContext(6, RoundingMode.FLOOR);
// returns the rounding mode of this MathContext
// ma_co1 i.e. RoundingMode is the second
// parameter set in MathContext Constructor
// i.e. CEILING in ma_co1
RoundingMode rm = ma_co1.getRoundingMode();
System.out.println("ma_co1.getRoundingMode(): " + rm);
// returns the rounding mode of this MathContext
// ma_co2 i.e. RoundingMode is the second
// parameter set in MathContext Constructor
// i.e. HALF_UP in ma_co2 it the default set
// when we don't use other rounding mode
rm = ma_co2.getRoundingMode();
System.out.println("ma_co2.getRoundingMode(): " + rm);
// returns the rounding mode of this MathContext
// ma_co3 i.e. RoundingMode is the second
// parameter set in MathContext Constructor
// i.e. FLOOR in ma_co1
rm = ma_co3.getRoundingMode();
System.out.println("ma_co3.getRoundingMode(): " + rm);
}
}
Output
输出量
ma_co1.getRoundingMode(): CEILING
ma_co2.getRoundingMode(): HALF_UP
ma_co3.getRoundingMode(): FLOOR
翻译自: https://www.includehelp.com/java/mathcontext-getroundingmode-method-with-example.aspx
java 根据类名示例化类
java 根据类名示例化类_Java MathContext类| 带示例的getRoundingMode()方法相关推荐
- java 根据类名示例化类_Java即时类| from()方法与示例
java 根据类名示例化类 即时类from()方法 (Instant Class from() method) from() method is available in java.time pack ...
- java 根据类名示例化类_Java即时类| EpochSecond()方法的示例
java 根据类名示例化类 EpochSecond()方法的即时类 (Instant Class ofEpochSecond() method) Syntax: 句法: public static I ...
- java 根据类名示例化类_Java即时类| plusMillis()方法与示例
java 根据类名示例化类 即时类plusMillis()方法 (Instant Class plusMillis() method) plusMillis() method is available ...
- java 根据类名示例化类_Java LocalDateTime类| atOffset()方法与示例
java 根据类名示例化类 LocalDateTime类atOffset()方法 (LocalDateTime Class atOffset() method) atOffset() method i ...
- java 根据类名示例化类_Java即时类| minusNanos()方法与示例
java 根据类名示例化类 即时类minusNanos()方法 (Instant Class minusNanos() method) minusNanos() method is available ...
- java 根据类名示例化类_Java LocalDateTime类| 带示例的getNano()方法
java 根据类名示例化类 LocalDateTime类getNano()方法 (LocalDateTime Class getNano() method) getNano() method is a ...
- java 根据类名示例化类_Java即时类| getEpochSecond()方法与示例
java 根据类名示例化类 即时类getEpochSecond()方法 (Instant Class getEpochSecond() method) getEpochSecond() method ...
- java 根据类名示例化类_Java LocalDateTime类| ofInstant()方法与示例
java 根据类名示例化类 LocalDateTime类的Instant()方法 (LocalDateTime Class ofInstant() method) ofInstant() method ...
- java 根据类名示例化类_Java LocalDateTime类| AdjustInto()方法与示例
java 根据类名示例化类 LocalDateTime类AdjustInto()方法 (LocalDateTime Class adjustInto() method) adjustInto() me ...
最新文章
- Netty入门教程——认识Netty
- Django(part2)--创建项目与Django目录结构
- debian9为什么默认是pip2_VirtualBox内刚刚安装完Debian9系统,也无法设置共享文件夹。解决的方法就是安装VirtualBox客户端增强包。...
- ASP.NET性能优化之分布式Session
- 《普林斯顿微积分读本》学习笔记
- 微信点餐 创建订单报外键错误
- iTextSharp
- CMDN创新应用推荐:搜狗号码通
- c语言中十进制转化二进制八进制十六进制,十进制转化为二进制八进制十六进制...
- 2011考研数学核心题型-陈文灯
- JavaScript 数组和函数
- html5 dreamlive,DREAM LIVE 5th Tour Stargazer即将开演
- sqlserver转mysql_数据库 SQLServer转MySQL数据库
- html涟漪动画效果,CSS+JS实现水滴涟漪动画按钮效果的示例代码
- 队列的定义及其基本操作
- Ubuntu18.04使用校园网上网的问题(以锐捷客户端为例)
- python编写一个程序、输入一个数判断其是偶数还是奇数_编写一个程序,判断用户输入的整数是偶数还是奇数。 (7.0分)_学小易找答案...
- Spring Security 参考手册(一)
- 域名绑定动态IP最佳实践
- 数字中国建设进行时:吉林大学党委常务副书记冯正玉一行调研实在智能
热门文章
- 各个图标的意思_冬奥体育图标设计团队负责人林存真:每一个图标要画100稿以上...
- 相对熵与交叉熵_熵、KL散度、交叉熵
- android layout.inflater,Android - LayoutInflater
- ilm 和dlm差异_《存储e周刊》第28期 信息生命周期管理之争
- 单片机复位后为什么要对sp重新赋值_51单片机系列之2点亮第一个led小灯
- 和python哪个容易胖_为什么有些人特别容易胖?
- linux课堂笔记(6)
- mongotemplate中save抛出异常_异常处理的三个好习惯 | Python 工匠
- 【动态规划】多重背包
- JavaSE基础知识学习-----泛型