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] Maximum Difference by Remapping a Digit with Java](https://realcoder.techss24.com/wp-content/uploads/2023/02/Solved-Maximum-Difference-by-Remapping-a-Digit-with-Java-300x169.png)
![[Solved] Series 2 with C++, Python, Java](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Series-2-with-C-Python-Java-300x200.png)
![[Solved] Evaluate Boolean Binary Tree LeetCode Contest](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Evaluate-Boolean-Binary-Tree-LeetCode-Contest-300x200.png)