
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7442 Articles for Java

18K+ Views
Cube of a value is simply three times multiplication of the value with self.For example, cube of 2 is (2*2*2) = 8.AlgorithmSteps to find a cube of a given number in Java programming:Take integer variable A.Multiply A three times.Display result as Cube.Exampleimport java.util.Scanner; public class FindingCube { public static void main(String args[]){ int n = 5; System.out.println("Enter a number ::"); Scanner sc = new Scanner(System.in); int num = sc.nextInt(); System.out.println("Cube of the given number is "+(num*num*num)); } }OutputEnter a number :: 5 Cube of the given number is 125

18K+ Views
Cube of a value is simply three times multiplication of the value with self.For example, cube of 2 is (2*2*2) = 8.AlgorithmSteps to find a cube of a given number in Java programming:Take integer variable A.Multiply A three times.Display result as Cube.Exampleimport java.util.Scanner; public class FindingCube { public static void main(String args[]){ int n = 5; System.out.println("Enter a number ::"); Scanner sc = new Scanner(System.in); int num = sc.nextInt(); System.out.println("Cube of the given number is "+(num*num*num)); } }OutputEnter a number :: 5 Cube of the given number is 125

16K+ Views
In statistics math, a mode is a value that occurs the highest numbers of time. For Example, assume a set of values 3, 5, 2, 7, 3. The mode of this value set is 3 as it appears more than any other number.Algorithm1.Take an integer set A of n values. 2.Count the occurrence of each integer value in A. 3.Display the value with the highest occurrence.ExampleLive Demopublic class Mode { static int mode(int a[], int n) { int maxValue = 0, maxCount = 0, i, j; for (i = 0; i < ... Read More

16K+ Views
In statistics math, a mode is a value that occurs the highest numbers of time. For Example, assume a set of values 3, 5, 2, 7, 3. The mode of this value set is 3 as it appears more than any other number.Algorithm1.Take an integer set A of n values. 2.Count the occurrence of each integer value in A. 3.Display the value with the highest occurrence.ExampleLive Demopublic class Mode { static int mode(int a[], int n) { int maxValue = 0, maxCount = 0, i, j; for (i = 0; i < ... Read More

343 Views
Permutation refers a number of ways in which set members can be arranged or ordered in some fashion. The formula of permutation of arranging k elements out of n elements is −nPk = n! / (n - k)!Algorithm1. Define values for n and r. 2. Calculate factorial of n and (n-r). 3. Divide factorial(n) by factorial(n-r). 4. Display result as a permutation.Exampleimport java.util.Scanner; public class Permutation { static int factorial(int n) { int f; for(f = 1; n > 1; n--){ f *= n; ... Read More

343 Views
Permutation refers a number of ways in which set members can be arranged or ordered in some fashion. The formula of permutation of arranging k elements out of n elements is −nPk = n! / (n - k)!Algorithm1. Define values for n and r. 2. Calculate factorial of n and (n-r). 3. Divide factorial(n) by factorial(n-r). 4. Display result as a permutation.Exampleimport java.util.Scanner; public class Permutation { static int factorial(int n) { int f; for(f = 1; n > 1; n--){ f *= n; ... Read More

1K+ Views
The process of finding the square root of a number can be divided into two steps. One step is to find integer part and the second one is for fraction part.AlgorithmDefine value n to find the square root of.Define variable i and set it to 1. (For integer part)Define variable p and set it to 0.00001. (For fraction part)While i*i is less than n, increment i.Step 4 should produce the integer part so far.While i*i is less than n, add p to i.Now i have the square root value of n.ExampleLive Demopublic class SquareRoot { public static void main(String ... Read More

1K+ Views
The process of finding the square root of a number can be divided into two steps. One step is to find integer part and the second one is for fraction part.AlgorithmDefine value n to find the square root of.Define variable i and set it to 1. (For integer part)Define variable p and set it to 0.00001. (For fraction part)While i*i is less than n, increment i.Step 4 should produce the integer part so far.While i*i is less than n, add p to i.Now i have the square root value of n.ExampleLive Demopublic class SquareRoot { public static void main(String ... Read More

7K+ Views
For a given a string, write a Java program to find the frequency of a particular character. In Java, String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). Finding Frequency of a Character in a String To find the Frequency of a character in a given String, follow the below ways − Using for Loop Using Stream API Using for loop In this approach, use the for loop to compare each character in the given string with the character whose ... Read More

7K+ Views
For a given a string, write a Java program to find the frequency of a particular character. In Java, String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). Finding Frequency of a Character in a String To find the Frequency of a character in a given String, follow the below ways − Using for Loop Using Stream API Using for loop In this approach, use the for loop to compare each character in the given string with the character whose ... Read More