JAVA SP T


Lets dive into snapshot of my programs!💻

18.How to convert double to int

💡Code:

public class DoubleToIntConversion7078 {
                public static void main(String[] args) {
                    // Example double
                    double doubleValue = 123.456;
            
                    // Convert double to int (explicit conversion with casting)
                    int intValue = (int) doubleValue;
            
                    // Print the converted int value
                    System.out.println("Converted int value: " + intValue);
                }
            }
            
           

📸Output :

output