Below is my code:
import
java.util.Scanner;
class
reverse
{
public
static void main(String s[])
{
int
a,b,c=0;
System.out.println("enter no. ");
Scanner
scan=new Scanner(System.in);
a=scan.nextInt();
System.out.println("you
entered ="+a);
while(a!=0)
{
b=a%10;
c=c*10+b;
a=a/10;
}
System.out.println("reverse
no is "+c);
}
}
Step 1: After
writing this in notepad save the file with the name followed by (.java) for eg. I saved it with reverse.java
Step 2 : Open command prompt
Step 3 : Write javac reverse.java - Press
Enter for compilation
Step 4
: Write java
reverse for execution
Output:

Image 1.