How To Print Square In Java?


package javaapplication1;

import javax.swing.* ;


public class JavaApplication1 {

   
    public static void main(String[] args) {
        
    String input = JOptionPane.showInputDialog("Enter Number");

    int num = Integer.parseInt(input);

    int ans = num * num;

    JOptionPane.showMessageDialog(null, "Square"+ ans);

    System.exit(0);

}
        
    }



Comments