Length of an Array in Java | Java Program to find Length of an Array

In this article you will learn how to find array length in java. But, before learning how to find array length, you should know exactly array length means what.

In short array length means the limit of elements that array can hold. See in the below diagram we have stored 7 elements in array so length of this array is 7.

How to Print Arrays in Java | Java Program to Accept and Print Array Elements

In this article we are going to learn how to accept and print array elements in Java. 

How to print arrays in java: 

To print array elements we first need to accept it from user. In this post we will learn how to accept array elements from user dynamically and print it on the output screen. Simple java program to insert elements in array. 

How to Sort Arrays in Java

In this post we will learn how to write a  java program to sort array elements. How to sort arrays in java. Sorting array elements means storing or printing it in ascending or descending order. So let's see how to print given array elements in sorted manner.

Java Program to Print Square of Given Array Elements

In previous post we learnt how to print multiplication of given array elements. In this post we will learn how to print squares of given array elements. So let's get started... :)

Java Program to Print Multiplication of Given Array Elements

Java program to print multiplication of given array elements

In previous post we learnt how to print Sum of given array elements. In this post we will learn how to print multiplication of given array elements. 

Java Program to Print Sum of given Array Elements

In previous  post we learnt how to check given element is present in array or not. In this post we will learn how to print sum of given array elements. So let's get started... :)


  Step by step logic of the given program:


1. Accept array limit from user store it in variable say lim.

2. Accept elements from user. Run a for loop from 0 to arr.length-1 and store elements one by one in array:

Java Program to Check whether Given Element is Present in Array or not

In previous tutorial we learnt how to accept and print array elements. In this post we will learn is given element is present in array or not, Java program to check whether given element is present in array or not.

Factorial Program In Java

Factorial Program in Java:

Factorial of a number means the product of all positive descending integers. 
for example: If we want to calculate factorial of 5 then it will be written as 
5 x 4 x 3 x 2 x 1 = 120 . So 120 is the factorial of  5.
  

  Program to Print Factorial of a given number:

Fibonacci Series Program In Java

Fibonacci Series In Java:

The fibonacci series is a series where the next number is the sum of previous two numbers.  
for examples:  0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc

above you can see first two numbers of fibonacci series are 0 and 1.

Java program to calculate gross salary of an employee

Ex: Write a java program to calculate gross salary of an employee. How to write a java program to calculate gross salary of an employee using DA and HRA. Java program to calculate gross salary of an employee using DA and HRA.  

We can calculate gross salary   of an  employee using following DA and HRA. The  DA is   20%   of   the   basic   salary   while   the   HRA   is   30%   of   the   basic salary and gross salary is addition of basic salary, DA and HRA.

Java Program to check Given Number is Prime or not

EX: Write a Java Program to check given number is prime or not.


  What is prime number?

Prime number is a number that is greater than 1 and divided by 1 and itself only.
For example: 2, 3, 5, 7, 11, 13, 17, 19, 23... etc. are prime numbers.

Java Program to check Given Number is Palindrome or not

EX: Write a java program to check given number is palindrome or not. How to write a java program to check palindrome number.


  What is Palindrome Number?

A palindrome number is a number that is same after reverse. For example: 252, 676, 77577, 1234321 etc.

Basic Java Programming Examples and Solutions

In previous post we learnt what is java programming  or introduction of java programming, In this article you will learn basic of java programming with lot of  java programming exercises, examples and their solutions.

Top Programming Interview Questions in C

In this article I will share some most commonly asked interview questions for you.

There are lot of computer science students, engineering students and programmers applying for interview to get job and start their career in software industries.

There are many big companies like Microsoft, Google, Amazon, Facebook and many other big organizations hires new software developers and programmers every year.

C program to display user details using id

EX: Write a C program to display user details using id. How to  write a C program to display user details. C program to display student details using their id.


In this program we will use switch case to print user details.... But you can also do this program using if-else-if statements.

How to write a id and password validation program in C

EX: Write a C program to print message only if id and password is correct. How to write a id and password validation program in C. C program for login using id and password.

In this program we will use Nested switch statement in C. In simple words Nested switch statement means switch statement defined inside the another switch statement. 

C program to append data into a file

In this program we will learn How to append data into a file.

EX: Write a C program to append data into a file, How to write a C program to append contents into a file. C program to append data into a file.

C program to search the number from array with its position

In these program we will learn how to write a C program to search the number from array with its position.


EX: Write a C program to search the number from array with its position. How to write a C program to search the element from array elements. C program to search the number from array with its position.

C program to replace an element in an array with its position

In these example we will learn how to replace or insert new element in an array. 

Ex: Write a C program to replace an element in an array with its position, How to write a C program to replace an element from array, C program to insert and replace element from array.


C program to get data from user and store it into the file

In these tutorial we will learn how to input data from user and store it into the file...


EX: Write a program in C to create and store information in a text file, How to write C program to get data from user and print it on the output screen, C program to write data into a file.

C program to read data from file using fgets() function

In this exercise we will learn how to read data from file using fgets() function... 

EX: Write a C program to read data from file using fgets(), C program to read data from file, How to read content from the file in C.


In previous program we learnt how to read data from file using fgetc(). In this program we will use  fgets() to read content from the file.

C program to read data from file using fgetc() function

 In this program we will learn how to read data from file...

EX: Write a C program to read data from file, C program to read data from file and display its contents.

Write a C program to create a file

EX: Write a C program to create a file. How do you create file in file handling. C program to create file.

To learn file handling in C programming first we need to start from creating a file in C. To create a file in C there is a following syntax is used.

Java program to calculate foot to centimeters

 EX: Write a java program to calculate foot to centimeters. How to write a java program to calculate foot to centimeters. Java program to calculate foot to centimeters.

Java program to calculate inch to meters

EX: Write Java program to calculate inch to meters. How to write java program which calculate inch to meters. Java program to calculate inch to meters.

Java program to compute expression and print output.

EX: Write a java program to calculate the expression and print output. How to write a java program which will compute expression and print output on the output screen. java program to compute expression and print output.

C program to print ASCII value of character

EX: Write a C program to print ASCII value of character. How to write a C program which prints ASCII value of character. C program to print ASCII value of character.

C program to accept input from user and print it on the output screen

 EX: Write a c program to accept input from user and print it on the output screen. How to write a c program to accept input from user and print it on the output screen. C program to accept input from user and print it on the output screen.

Java program to accept five subjects marks from student and print total and percentage on the output screen

EX: Write a java program to accept five subjects marks from student and print total and percentage on the output screen. How to write a java program to accept five subjects marks and print total and percentage. Java program to accept marks from students and print total and percentage.

Java program to find area of triangle

EX: Write a java program to find area of triangle. How to write a java program to find area of triangle. Java program to find area of triangle.

Write a java program to find area of circle

 EX: Write a java program to find area of circle. How to write a java program to find area of circle. Java program to find area of circle.


Logic to find area of circle: 

To find area of circle we can use formula of area of circle which is Ï€ r² .

Here, r is radius and value of pi is 3.14. 

Java program to print addition, subtraction, multiplication and division of given two numbers

EX: Write a java program which perform addition, subtraction, multiplication and division. How to write a java program which prints addition, subtraction, multiplication and division of  two numbers. java program which perform addition, subtraction, multiplication and division.

Java Scanner class | Java Scanner demo program

Scanner Class In Java:

Scanner class is used to collect user input. To create an object of Scanner class first we need to import java.util.Scanner class and we need to pass predefined object System.in.

  •  To read the values of certain data types, Syntax is: nextDatatype() 

Write a java program to swap two numbers

Ex: Write a java program to swap two numbers. How to write a java program to swap two numbers using temp variable. java program to swap two numbers using temp variable.

Write a Java Program to Print Given Number is Even or Odd

In this example, You will learn how to print given number is even or odd using java. In below program we will use if-else statements to check given number is even or odd.

Write first java program which prints message on the output screen

Ex: Write your first java program which prints Hello Java. How to Write first java program which prints message on the output screen. Java program which prints Hello Java message on the output screen

Java programming introduction for beginners

Java Programming introduction for beginners

  Introduction to Java programming:

Java is a mostely used and one of the most popular programming languages, which is developed by sun Microsystems in 1991. Java is developed by James Gosling and Patrick Naughton.