Decimal to octal

The problem

Write a program that prompts the user to enter a decimal integer and displays its corresponding octal value. Use Java’s Integer.toOctalString(int) in this program.

Breaking it down

public static void main(String[] strings) {

    Scanner input = new Scanner(System.in);

    System.out.print("Enter an integer: ");
    int number = input.nextInt();

    input.close();

    System.out.println(Integer.toOctalString(number));
}

Output

Enter an integer: 100
144