JAVA SP T


Lets dive into snapshot of my programs!💻

30.How to convert Decimal to Octal.

💡Code:

public class DecimalToOctalConversion7078 {
                public static void main(String[] args) {
                    // Example decimal value
                    int decimalValue = 42;
            
                    // Convert decimal to octal
                    String octalString = Integer.toOctalString(decimalValue);
            
                    // Print the converted octal value
                    System.out.println("Converted octal value: " + octalString);
                }
            }
            
           

📸Output :

output