Java round() 方法
Java 教程
· 2019-02-08 12:28:32
round() 方法返回一个最接近的int、long型值。
语法
该方法有以下几种语法格式:
long round(double d) int round(float f)
参数
d -- double 或 float 的原生数据类型
f -- float 原生数据类型
返回值
返回一个最接近的int、long型值,方法会指定返回的数据类型。
实例
实例
public class Test{
public static void main(String args[]){
double d = 100.675;
double e = 100.500;
float f = 100;
float g = 90f;
System.out.println(Math.round(d));
System.out.println(Math.round(e));
System.out.println(Math.round(f));
System.out.println(Math.round(g));
}
}
编译以上程序,输出结果为:
101 101 100 90
点击查看所有 Java 教程 文章: https://codercto.com/courses/l/12.html
网络是怎样连接的
[日]户根勤 / 周自恒 / 人民邮电出版社 / 2017-1-1 / CNY 49.00
本书以探索之旅的形式,从在浏览器中输入网址开始,一路追踪了到显示出网页内容为止的整个过程,以图配文,讲解了网络的全貌,并重点介绍了实际的网络设备和软件是如何工作的。目的是帮助读者理解网络的本质意义,理解实际的设备和软件,进而熟练运用网络技术。同时,专设了“网络术语其实很简单”专栏,以对话的形式介绍了一些网络术语的词源,颇为生动有趣。 本书图文并茂,通俗易懂,非常适合计算机、网络爱好者及相关从......一起来看看 《网络是怎样连接的》 这本书的介绍吧!