8 – Best Java program to reverse a number

Java program to reverse a number

Java program to reverse a number : This simple java program will reverse any given number. This program will help learners to built their programming logic.

How to reverse a number in Java?

import java.util.*;
class Reverse
public static void main(String agr[])
int num, rev=0, x;
Scanner in = new Scanner(System.in);
System.out.println("Enter any number : ");
num = in.nextInt();
x = num;
rev = (rev*10) + (x%10);
System.out.println("Reverse of " + num + " is " + rev);

Output :

Enter any number :
Reverse of 156 is 651


Enter any number :
Reverse of 124 is 421


SYIT Practical Programs
SY-1-a Easy Java program to print multiplication table
SY-1-b Easy program to print inverted pyramid pattern of stars in Java
SY-1-c Easy Java program to print the area and perimeter of a circle
SY-2-c Easy Java program to reverse a string
SY-3-a Easy Java program to count the letters, spaces, numbers and other characters
SY-3-c Easy to find the smallest and largest element from the array in Java
SY-4-a Easy java program to sort array in ascending and descending order
SY-4-b Easy program on constructor and destructor in Java
SY-4-c Implementation of abstract class in Java in easy way
SY-5-a Easy java program to implement single level inheritance
SY-5-b Easy java program to implement method overriding
SY-5-c Easy java program to implement multiple inheritance
SY-6-a Easy program to create package in Java
SY-6-b easy java program to add two matrices and print the resultant matrix
SY-6-c Java program for multiplying two matrices in easy way
SY-7-a easy java program to implement the vectors
SY-7-c Easy and simple java program to implement multithreading
SY-8-a java program to open a file and display the contents in the console window in easy way
SY-8-b Java program to copy the contents from one file to other file in easy way
SY-9-a Java AWT program to print the factorial for an input value in easy way
SY-9-b Java AWT program to perform various string operations in easy way
SY-9-c Easy java program to implement exception handling
SY-10-a Java AWT program to accept and display student details in easy way
ST-10-b Java program to design a calculator based on AWT application in easy way
SYCS Practical Programs Semester 3
Java program to solve quadratic equations to print the roots of ax2+bx+c=0
Java program to add two matrices
Accept n strings. Sort names in ascending order
Create a package: Animals. In package animals create interface Animal with suitable behaviors. Implement the interface Animal in the same package animals
Demonstrate Java inheritance using extends keyword.
Demonstrate method overloading and method overriding in Java.
Demonstrate creating your own exception in Java.
Using various swing components design Java application to accept a student’s resume. (Design form)
Write a Java List example and demonstrate methods of Java List interface.
Design simple calculator GUI application using AWT components
Write a Java program that takes a number as input and prints its multiplication table upto 10.
Java program to print reverse pyramid
Write a Java program to print the area and perimeter of a circle
SYCS Practical Programs Semester 4
SYCS-5 Java application to demonstrate servlet life cycle in easy way
Practice Program
1 – Best Java program to find factorial of a number
2 – Java program to check if number is Even or Odd
3 – Best Java program to check prime number
4 – Simple and easy Java program to calculate area
5 – Best Java program to convert decimal to binary
6 – Best Java program to implement stack using array
7 – Best Java program to check palindrome number
8 – Best Java program to reverse a number
9 – Easy and simple billing system program in java swing
10 – Easy and simple java program for billing system of tour and travels
More coming soon…


We are aiming to explain all concepts of Java in easiest terms as possible.

Leave a Comment