Help me in solving USRJ1AV2 problem

My issue

How to solve this problem

My code

import java.util.Scanner;

class Codechef
{
	public static void main (String[] args)
	{
		// update your code below this line
    int num;
    Scanner scanner = new Scanner(System.in);
    num = scanner.nextInt();
    System.out.println(num);

     if (scanner.hasNextInt()) {
            num = scanner.nextInt();
            
            // Calculate and print the square
            int square = num * num;
            System.out.println("The square of " + num + " is " + square);
        } else {
            System.out.println("Invalid input. Please enter an integer.");
        }

        // Close the scanner
        scanner.close();

	}
}

Learning course: Learn Java
Problem Link: CodeChef: Practical coding for everyone

@sakthipriya23
U have to do simply like this

import java.util.Scanner;

class Codechef
{
	public static void main (String[] args)
	{
		// your code goes here
		Scanner read = new Scanner(System.in);
		int num = read.nextInt();
		System.out.println(num * num);
	}
}
```