00:01
So we will start by writing import java .util .scanner.
00:11
So scanner is a class that is used to take input from the user.
00:17
So it is present in java .util package.
00:20
Since we want to use this in our program, so we are importing this in our program.
00:24
Next we will write the class name.
00:26
So class 5 digit palindrome.
00:34
Inside this we will write public static void main.
00:49
So public is an access specified.
00:51
That means anyone can access it.
00:53
Static means it's a class related method.
00:55
Void means it will not return anything.
00:57
And main is the name of the function.
01:00
Inside this we will pass a command line argument consisting of an array of strings.
01:05
So we are writing strings args.
01:12
Now inside this, first of all, we will create the object of scanner class so that we can use any method inside this class.
01:21
So we are writing scnr.
01:24
We need scanner system .int.
01:33
Next we will take the input from the user and store it in n.
01:42
Scnr .nextint.
01:47
Next int is a method that is used to read integer inputs.
01:53
Similarly, we will take one more variable int p which will store the palindrome number and we are initializing this as zero.
02:01
Next we will check if, as it is given in the question, the range for the variable n should be 11111 and it should be less than equals to 99999.
02:18
It should be in this range.
02:20
If the number is in this range, it will come inside.
02:24
It will run the for loop for int i is equals to n.
02:30
I should be greater than zero.
02:33
I is equals to i by 10.
02:37
And inside this, it will write p is equals to p into 10 plus i mod 10.
02:56
And after this, if it will come outside and check if the palindrome number is equals to the original number, then it will print system .out .println.
03:13
It will print a valid five -digit palindrome.
03:31
Otherwise, it will print in else, it will print system .out .println.
03:44
It will print invalid five -digit palindrome and it will close this if condition.
04:08
Now, outside this if condition, if the value does not fall in this range, it will print system .out .println...