Java Program to Reverse a Number without using Recursion

This is the Java Program to Reverse a Given Number Without Using Recursion. Problem Description Write a Java Program to Reverse a Given Number Without Using Recursion. Problem Solution Using a loop, extract the last digit of the number and add it at the end of the reverse formed till now. . Program/Source Code Here … Read more

advertisement

Java Program to Perform Arithmetic Operations

This is a Java Program to Calculate the Sum, Multiplication, Division and Subtraction of Two Numbers. Enter any two integers as input. Now choose from the given options to perform various operations on given integers. Here is the source code of the Java Program to Calculate the Sum, Multiplication, Division and Subtraction of Two Numbers. … Read more

advertisement

Java Program without using the Main() Function

This is a Java Program to Print any Statement Without Using the Main Method. We put the statement to be printed in a static block. The static block executes before main method hence we get the desired output. But in case of JDK7 the code would not execute as it looks for main method before … Read more

advertisement

Java Program to Extract Last Two Digits of a Given Year

This is a Java Program to Extract Last two Digits of a given Year. Enter any integer as input. After that we perform modulus and division operations to extract last two digits of the given integer as output. Here is the source code of the Java Program to Extract Last two Digits of a given … Read more

advertisement

Java Program to Shutdown Computer in Linux

This is a Java Program to Shutdown or Turn Off the Computer in Linux. We first check the name of the operating system of the computer. If its Linux we proceed else we would not. Now we would give number of seconds as input after which we want to turn off computer and then concatenate … Read more

advertisement

Java Program to Extract Digits from a Given Number

This is a Java Program to Extract Digits from A Given Integer. Enter any integer as input. After that we perform several operations like modulus and division to know the number of digits in given integer and then print each of the digits of the given number. Here is the source code of the Java … Read more

advertisement

Palindrome Program in Java

Problem Description Write a Java Program to check whether a given number is Palindrome or not. What is Palindrome in Java? A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. Examples 272, 515, 71417. Problem Solution 1. Enter the number as an input. 2. Reverse … Read more

advertisement

Java Program to use Underscores in Numeric Literal

This is a Java Program to Use Underscores in Numeric Literal. A literal is an explicit value. For example : int number=123; The value 123 is a literal. Since it’s a normal base-10 value, we might say it is a decimal literal. We have used underscore at various positions in different types of datatype values … Read more

advertisement

Java Program to Illustrate use of Binary Literals

This is a Java Program to Illustrate Use of Binary Literals.A literal is an explicit value. To specify a binary literal, add the prefix 0b or 0B to the number. For example : int number=123; The value 123 is a literal. Since it’s a normal base-10 value, we might say it is a decimal literal. … Read more

advertisement

Java Program to Increment by 1 to all the Digits of a Given Integer

This is a Java Program to Increment by 1 All the Digits of a given Integer. Enter any integer as input. After this we perform various operations like modulus and division to extract each digit and increment it by one. Here is the source code of the Java Program to Increment by 1 All the … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.