Typecasting of double variable to integer
With this code you can type cast a double variable value to integer.
Code Java:
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);
}
}
The double value is 420.5 and the application prints out the integer value of 420
Re: How to Type cast convert double to integer
Code Java:
public a() {
}
public static void main(String args[]){
double d = 5.5;
int i = (int)(d);
System.out.println(i);
}
}
Re: How to Type cast convert double to integer
Code Java:
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);
}
}