Java Double intValue()方法具有什么功能呢?
下文笔者将讲述intValue()方法的功能简介说明,如下所示:
返回Double对象对应的int值
intValue()方法的功能
java.lang.Double.intValue()方法的功能:返回Double对象对应的int值
intValue()方法的语法
语法 public int intValue() 参数 无 返回值 返回Double对象对应的int值例:
package com.java.other;
import org.junit.Test;
public class other {
/**
* java265.com Double类的示例分享
*
* @throws Exception
*/
@Test
public void test() throws Exception {
Double obj1 = new Double("88.98");
Double obj2 = new Double("88.18");
Double obj3 = new Double("88.989");
Double obj4 = new Double("-88.98");
Double obj5 = new Double("-88.18");
Double obj6 = new Double("-88.989");
System.out.println(obj1.intValue());
System.out.println(obj2.intValue());
System.out.println(obj3.intValue());
System.out.println(obj4.intValue());
System.out.println(obj5.intValue());
System.out.println(obj6.intValue());
}
}
------运行以上代码,将输出以下信息-----
88
88
88
-88
-88
-88
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。


