Multiples of 2 with an Infinite Loop in Java

(Multiples of 2 with an Infinite Loop) Write an application that keeps displaying in the command window the multiples of the integer 2—namely, 2, 4, 8, 16, 32, 64, and so on. Your loop should not terminate (i.e., it should create an infinite loop). What happens when you run this program?

Multiples of 2 with an Infinite Loop in Java

/*
 *       Filename:  MultiplesOf2.java
 *
 *    Description:  Exercise 4.33 - Multiples of 2 with an Infinite Loop
 *
 *  @Author:  Bilal Tahir Khan Meo
 *  Website: https://www.codeblah.com
 *
 * =====================================================================================
 */
public class MultiplesOf2{
    public static void main(String[] args){
        int x = 2;

        while(true){
            System.out.printf("%d\n", x *= 2);
        }
    }
}