|
||
|
||||
|
With this code you can type cast a double variable value to integer.
Java Code
public class TypeCastDouble {
public static void main(String[] args){
double myDouble = 420.5;
//Type cast double to int
int i = (int)myDouble;
System.out.println(i);
}
}
__________________
Don't forget to add code tags around your code: ![]() Forum Tip: Add to peoples reputation ( ) by clicking the button on their useful posts.
|
![]() |
| Tags |
| convert double to integer, double to integer, type cast int |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to Format a double value to 2 decimal places | JavaPF | Java Code Snippets and Tutorials | 1 | 09-02-2010 04:07 PM |
| how to solve this type of stackoverflowerror... | sanatkumar | Exceptions | 2 | 07-07-2009 07:40 PM |
| [SOLVED] make a integer negative? | Lizard | What's Wrong With My Code? | 3 | 14-05-2009 07:27 PM |
| How to check an input is an integer as oppose to a float | Konnor | File I/O & Other I/O Streams | 3 | 02-02-2009 10:37 AM |