Java programming program examples

Top 100+ Java Programming Examples With Output

Java Programming Examples With Output | Learn Java Programming Language through examples. Develop java basic programs to understand the basic concepts of Java. These are the basic Java program examples with output. After learning the procedure to develop the program try to develop it on your own and then compare the code given on the website. This page contains frequently, unique, and popular Java programs. For all Java programs visit here:- Java Program List

Java Basic Programs

  1. Java Hello World program
  2. Java Addition Program
  3. Average of Two Numbers
  4. Total & Average of 3 Subjects
  5. Calculate Simple Interest
  1. Calculate Compound Interest
  2. Display ASCII value in Java
  3. Calculate Area of Circle in Java
  4. Find Area of Rectangle in Java
  5. Find the Area of Triangle in Java
  1. Swapping two Numbers in Java
  2. Distance Between 2 Points in Java
  3. Simple Mortgage Calculator in Java
  4. Miles to Kilometers Java Program
  5. Unit Conversion Java Program

Java Programming Examples on Flow Control

Java flow control programs are based on conditional control statements (if, if-else and switch-case), loop control statements (while loop, do-while loop, for-loop), and Jump control statements (continue, and break). This section contains multiple Java programs. Some of them are formula-based programs, programs on different types of numbers, different types of printing patterns, flow-control-based conversion programs, and e.t.c.

  1. Java code to Check Even Odd
  2. Find the Greatest of 3 numbers
  3. How to Find exponents in Java
  4. Students’ Grades using Switch Case
  5. Iterate digits of a number
  1. Leap year program in Java
  2. Print Multiplication table
  3. Find Reverse of a number
  4. Find Factors of a number
  5. LCM of two numbers in Java
  1. HCF of two numbers in Java
  2. Roots of a quadratic equation
  3. Square Root of a Number
  4. Perfect Square Program
  5. Print 1 to 100 Without Loop
  1. Simple Calculator Program
  2. BMI (Body Mass Index) Calculator
  3. Electric Bill Java Program
  4. Find runtime of a Java Program
  5. Factorial of a Number in Java
  6. Golden Ratio Java Program
  1. Even Number in Java
  2. Odd Number in Java
  3. Prime Number in Java
  4. Twin prime Number
  5. Magic Number in Java
  1. Armstrong Number
  2. Palindrome Number
  3. Perfect Number Java
  4. Spy Number in Java
  5. Tech Number in Java
  1. Sunny Number in Java
  2. Automorphic Number
  3. Krishnamurthy Number
  4. Evil Number in Java
  5. Strong Number in Java
  1. Disarium Number Java
  2. Neon Number in Java
  3. Pronic Number in Java
  4. Duck Number in Java
  5. Harshad Number Java
  1. Kaprekar Number Java
  2. Buzz Number in Java
  3. Nelson Number in Java
  4. Special Number in Java
Читайте также:  Java character to chars

Array Programs in Java

  1. Find Length of Array in Java
  2. Different ways to Print Array
  3. Find the Sum of Array in Java
  4. Average in Java using Array
  5. Sum of Two Arrays Elements
  1. Compare Two Arrays in Java
  2. Copy Array in Java
  3. Merge Two Arrays in Java
  4. Merge Two Sorted Arrays
  5. Largest Number in Array
  1. Smallest Number in Array
  2. 2nd Largest Number in Array
  3. How to Sort an Array in Java
  4. Reverse an Array in Java
  5. GCD of N Numbers in Java
  1. Find the LCM of an Array in Java
  2. Linear Search in Java
  3. Binary Search Program in Java
  4. Remove Duplicates From the Array
  5. Insert Element at Specific Position
  1. Add Element to Array in Java
  2. Remove Element From Array in Java
  3. Count Repeated Elements in an Array
  4. How To Reduce The Size Of An Array In Java
  5. Find Odd Occurrence Number Array in Java
  1. Java Primitive Array To Wrapper Array
  2. Java Array of Random Numbers
  3. Find the Median of an Array in Java
  • How To Print An Array In Java In One Line
  • How To Append An Array In Java

Multi-dimensional array and Matrix Programs in Java

Источник

Java Programs – Java Programming Examples with Output

To understand a programming language you must practice the programs, this way you can learn any programming language faster. This page includes java programs on various java topics such as control statements, loops, classes & objects, functions, arrays etc. All the programs are tested and provided with the output. If you new to java and want to learn java before trying out these program, refer Java Tutorial.

Java Basic Programs

  • Java Program to Add two Numbers
  • Java Program to Check Even or Odd Number
  • How to print pattern in java
  • Java Program to add two binary numbers
  • Java Program to add two complex numbers
  • Java Program to Multiply two Numbers
  • Java Program to check Leap Year
  • Java Program to check whether input character is vowel or consonant
  • Java Program to calculate compound interest
  • Java Program to calculate simple interest
  • Java Program to find quotient and remainder
  • Java Program to calculate power of a number

Java Strings Programs

  • Java Program to Convert char to String and String to Char
  • Java Program to find duplicate characters in a String
  • Java Program to check Palindrome String using Stack, Queue, For and While loop
  • Java Program to sort strings in alphabetical order
  • Java Program to reverse words in a String
  • Java Program to perform bubble sort on Strings
  • Java program to find occurrence of a character in a String
  • Java program to count vowels and consonants in a String
  • Java Program to check two strings are anagram or not
  • Java Program to divide a string in ‘n’ equal parts
  • Java Program to find all subsets of a string
  • Java Program to find longest substring without repeating characters
  • Java Program to find longest repeating sequence in a string
  • Java Program to remove all the white spaces from a string
Читайте также:  Java add int to arraylist

Java Arrays Programs

  • Program to find number of elements in an array
  • Java Program to Calculate average of numbers using Array
  • Java Program to Add the elements of an Array
  • Java Program to reverse an array
  • Java Program to sort an array in ascending order
  • Java Program to convert char Array to String
  • Java Program to Add Two Matrix Using Multi-dimensional Arrays
  • Java Program to print the elements of an array present on odd Position
  • Java Program to print the elements of an array present on even Position
  • Java Program to copy all the elements of an array into another array
  • Java Program to count the frequency of each element in an array
  • Java Program to left rotate the elements of an array
  • Java Program to right rotate the elements of an array
  • Program to find duplicate elements of an array
  • Program to find largest element of an array
  • Program to find smallest number in an array
  • Program to remove duplicate elements in an array

Java Recursion Programs

Java Programs on Numbers

  • Java Program to display first 100 prime numbers
  • Java Program to display alternate prime numbers
  • Java Program to display prime numbers between 1 and 100 or 1 and n
  • Java program to break integer into digits
  • Java Program to check Prime Number
  • Java Program to check if a given number is perfect square
  • Java Program to find square root of a number without sqrt method
  • Java Program to print Armstrong numbers between a given range
  • Java Program to Find Sum of Natural Numbers
  • Java Program to check if a number is Positive or Negative
  • Java Program to generate Random Number
  • Java Program to check Armstrong number
  • Java Program to find GCD of two numbers
  • Java Program to find Largest of three numbers
  • Java Program to swap two numbers using bitwise operator
  • Java Program to find smallest of three numbers using ternary operator
  • Java Program to find largest of three numbers using ternary operator
  • Java Program to display even numbers from 1 to n or 1 to 100
  • Java Program to display odd numbers from 1 to n or 1 to 100
  • Java Program to Find average of 3 numbers
  • Java Program to Find HCF and LCM of Two Numbers
  • Peterson Number in Java
  • Sunny Number in Java
  • Tech Number in Java
  • Emrip Number in Java
  • Autobiographical Number in Java
  • Spy number in Java
  • Neon Number in Java
  • Fascinating Number in Java
  • Automorphic Number in Java
  • Sphenic Number in Java
  • Buzz Number in Java
  • Duck Number in Java
Читайте также:  Rgba with hex css

Java Input/Output Programs

Java Programs on Geometrical Calculations

Java Sorting/Searching Programs

Java Conversion Programs

  • Java Octal to Decimal Conversion
  • Java Decimal to Octal Conversion
  • Java Hexadecimal to Decimal Conversion
  • Java Decimal to Hexadecimal Conversion
  • Java Binary to Octal Conversion
  • Java Decimal to Binary Conversion
  • Java Binary to Decimal Conversion
  • Java int to char Conversion
  • Java char to int Conversion
  • Java char to String Conversion and vice versa
  • Java long to int Conversion
  • Java int to long Conversion
  • Java int to double Conversion
  • Java double to int Conversion
  • Java Program to find ASCII value of a character
  • Java String to int Conversion
  • Java int to String Conversion
  • Java String to double Conversion
  • Java double to String Conversion
  • Java String to long Conversion
  • Java long to String Conversion
  • Java String to boolean Conversion
  • Java boolean to String Conversion
  • Java String to float Conversion
  • Java float to String Conversion
  • Java String to Object Conversion
  • Java Object to String Conversion
  • Java Date to Timestamp Conversion
  • Java Timestamp to Date Conversion
  • Java String to Date Conversion
  • Java Date to String Conversion

Other Java Programs

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

Comments

what is the error in this program class p3
public static void main(int age)
if(age>=18)
system.out.println(“eligible for election”);
>
else
system.out.println(“not eligible for election”);
>
>

Hey..there is a syntax error in your program! The “s” of “system” must be in caps…that is,
It should be —
System.out.println(“eligible…”); I hope it helps!!

Four mistakes: 1. main method should have String []args as arguments instead of age. Use public static void main(String args[])
2. age should be declared as a variable before using. Use int age=10;
3. System.out.println instead of system.out.println.
4.Closing bracket fro class p3 missing. Use > at last.

This page is awesome For beginners…it is very helpful…give me example programs which will be useful for real time projects

How can I take an array for example five separate words and place them on separate lines evenly using astericks to make up the number on both ends in relation to the number entered by the user? Is a program to do this possible?

console application that receives any size of matrix and one parameter which is the Manhattan distance, this is K. The result should be Yes/No. Yes if there are any two similar items (integers) in the matrix that are in a distance of K from each other or less. Input: 1. Number of rows. 2. Matrix rows one line after the other in a new line between each matrix line. 3. K value. Output YES/NO Here is a sample for an input and output:

can you kindly provide program for the following
java a program to create an array of 10 integers. Accept values from the user in that array. Input another number from the user and find out how many numbers are equal to the number passed, how many are greater and how many are less than the number passed.

# Suppose 450 is 3 digit number ….So 3 is its digit length. In that way calculate 5 digit random number ….do not run by using range ….get random number using length itself

first U convert char to String with the method String s = String.valueof(char c), after this U convert String to numeric num like integer with Integer.parseint(String s)

Write a program to accept the length of and breath of a rectangle using scanner class and display its area and perimeter

can you please write a code on below question of complex number ?? Print the sum, difference and product of two complex numbers by creating a class named ‘Complex’ with separate methods for each operation whose real and imaginary parts are entered by user.

Write java program to find if a name exists in a list of names.The program should display how many times the name occurs in the list.The program should have at least two instance methods.

Hi where can i get real time example programs such as
1 find out the no of persons in a room
2 Find the electricity bill for one month

I am new to java and I hope this beginnersbook.com would be very helpful to me. I am gonna start learning Java. Thank you very much.

Program for password it must contain one upper case and lower case and number and size of password 8-15

If we type
System.out.println(“This is java”);
This will display the output :This is java
where as if you are taking about just the statement
System.out.println(“”);
Then it will print the blank or space in console

Источник

Оцените статью