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] Recreation Fair with Java, C++, Python, C](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Recreation-Fair-with-Java-C-Python-C-300x200.png)
![[Solved] Character Pattern 7 with Java, C++](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Character-Pattern-7-with-Java-C-300x200.png)
![[Solved] Number of digits with Java](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Number-of-digits-with-Java-300x200.png)