Java interview programs with output

Editorial Staff - - Java Programming


This page contains the collection of java interview programs with output that we have posted for beginners to learn java programming before the interview in the simple and easy way.

java program with examples

Problem: Java Program to Swap Numbers

Output:

Enter number x and y
10
20
Before Swapping
x value: 10
y value: 20
After Swapping
x value: 20
y value: 10

Problem: Java Program to Check Armstrong Number

Output:

Enter a number to check if it is an armstrong number:
153
Entered number is an armstrong number.
Enter a number to check if it is an armstrong number:
5
Entered number is not an armstrong number.

Problem: Fibonacci Series Program in Java

Output:

0 1 1 2 3 5 8 13 21 34

Problem: How to write a Java Program to Swap Number Without Temporary Variable

Problem: Java Program to Get IP Address

Output:

javac IPAddress.java
java IPAddress
124.253.78.30

Problem: Java Program to Check Leap Year

Output:

Enter any Year:
2000
2000 is a Leap Year.

Problem: Java program to compare strings

Output:

true
false
false
true

To increase your Java knowledge, practice all Java programs, here is a collection of 100+ Java problems with solutions.


About: Editorial Staff

Editorial Staff at FreeWebMentor is a team of professional developers leads by Prem Tiwari