- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert Double to Integer in Java
At first, initialize a double value −
double val = 978.65;
Now, convert the Double to Integer value using intValue() method −
Double d = new Double(val); int res = d.intValue();
Example
Following is the program to convert Double to Integer in Java −
public class Demo { public static void main(String args[]) { double val = 978.65; System.out.println("Double = "+val); Double d = new Double(val); int res = d.intValue(); System.out.println("Double to Integer value = "+res); } }
Output
Double = 978.65 Double to Integer value = 978
Advertisements