Command Line Argument Square: Write a program to accept a integer as command line argument and print the square of that integer.
Sample Input (Command Line Argument) 1:
10
Sample Output 1:
Square of the number :
100
Solution
class Main
{
public static void main(String jr[])
{
System.out.println("Square of the number :");
int a =Integer.parseInt(jr[0]);
System.out.println(a*a);
}
}Happy Learning – If you require any further information, feel free to contact me.
![[Solved] Command Line Argument Square with Java, C++ [Solved] Command Line Argument Square with Java, C++](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Command-Line-Argument-Square-with-Java-C.png)
![[Solved] Number of White Cells with Java, C++](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Number-of-White-Cells-with-Java-C-300x200.png)
![[Solved] Bob is doing a research in Pendulum. He is just pushing the pendulum aside Java, C++, Python](https://realcoder.techss24.com/wp-content/uploads/2023/05/Solved-Bob-is-doing-a-research-in-Pendulum.-He-is-just-pushing-the-pendulum-aside-Java-C-Python-300x169.png)
![[Solved] Art Competition with Java](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Art-Competition-with-Java-300x200.png)