- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 267 Articles for Java8
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
14K+ Views
Java supports two types of right shift operators. The >> operator is a signed right shift operator and >>> is an unsigned right shift operator. The left operands value is moved right by the number of bits specified by the right operand.Signed right shift operatorThe signed right shift operator '>>' uses the sign bit to fill the trailing positions. For example, if the number is positive then 0 will be used to fill the trailing positions and if the number is negative then 1 will be used to fill the trailing positions.Assume if a = 60 and b = -60; ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
616 Views
automatic resource management or try-with-resources is a new exception handling mechanism that was introduced in Java 7, which automatically closes the resources used within the try-catch block.ResourceA resource is an object which is required to be closed once our program finishes. For example, a file is read, database connection and so on.UsageTo use the try-with-resources statement, you simply need to declare the required resources within the parenthesis, and the created resource will be closed automatically at the end of the block. Following is the syntax of the try-with-resources statement.Syntaxtry(FileReader fr = new FileReader("file path")) { // use the resource ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
7K+ Views
AssociationAssociation refers to the relationship between multiple objects. It refers to how objects are related to each other and how they are using each other's functionality. Composition and aggregation are two types of association.CompositionThe composition is the strong type of association. An association is said to composition if an Object owns another object and another object cannot exist without the owner object. Consider the case of Human having a heart. Here Human object contains the heart and heart cannot exist without Human.AggregationAggregation is a weak association. An association is said to be aggregation if both Objects can exist independently. For ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
172 Views
It is an algorithm to perform factorization on given integers. Following is the program implementing the Rho Algorithm for Prime Factorization.ProgramLive Demopublic class PollardsRho { int num = 65; public int gcd(int a, int b) { int gcd = 0; for(int i = 1; i
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
4K+ Views
Sieve of Eratosthenes is the ancient algorithm to find prime numbers up to a given number.Algorithm1. Generate integers from 2 to n (Given number).2. Counting from 2 mark every 2nd integer. (multiples of 2)3. Now, starting from 3 mark every third integer. (multiples of 3)4. Finally, marking from 5 mark every 5th integer.(multiples of 5)Programimport java.util.Scanner; public class SievePrimeFactors { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter a number"); int num = sc.nextInt(); boolean[] bool = new boolean[num]; ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
365 Views
According to Euler’s criterion a square root of n under modulo p exists if and only if a number num exists such that num%p is equal to n%p.Programimport java.util.Scanner; public class EulersCriterion { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter n value :"); int n = sc.nextInt(); System.out.println("Enter p value :"); int p = sc.nextInt(); n = n % p; int flag = 0; for ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
181 Views
You can calculate the exponent of the largest power of a PrimeNumber that divides the factorial n! using Legendre's formula.Programimport java.util.Scanner; public class LegendresFormula { static int Largestpower(int n, int p) { int ans = 0; while (n > 0) { n /= p; ans += n; } return ans; } public static void main (String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the n value :"); ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
3K+ Views
Binomial coefficient (c(n, r) or nCr) is calculated using the formula n!/r!*(n-r)!. Following is the Java program find out the binomial coefficient of given integers.Programimport java.util.Scanner; public class BinomialCoefficient { public static long fact(int i) { if(i