WAP to typecast the following: Double to Integer

2 years ago
OOP Java

Compile code:

class DoubleToInt{
  public static void main(String[] args) {
    // create double type variable
    double num = 10.99;
    System.out.println("The double value: " + num);

    // convert into int type
    int data = (int)num;
    System.out.println("The integer value: " + data);
  }
}

Output:

0
Dipti KC
Jan 8, 2023
More related questions

Questions Bank

View all Questions