
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

872 Views
In this article, we will understand how to print a downward triangle star pattern using Java. In this pattern, the face of the triangle will be in a downward direction, and the base will be in an upward direction. We will learn through two examples: one where the user inputs the number of rows, and another where the number of rows is predefined in the program. Problem Statement Write a Java program to print a downward triangle star pattern. Below is a demonstration of the same. Input: Enter the number of rows : 8 Output: The downward triangle star pattern ... Read More

491 Views
In this article, we will understand how to print mirror upper star triangle pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the number of rows : 8OutputThe desired output would be −The mirror upper star pattern : ******** ******* ****** ***** **** *** ** *AlgorithmStep 1 - START Step 2 - Declare four integer values namely i, ... Read More

995 Views
In this article, we will learn to print the upper star triangle pattern in Java. Printing patterns is a common exercise to strengthen the understanding of loops in programming. One of the most popular patterns is the Upper Star Triangle, which visually resembles an inverted right-angled triangle of stars aligned from the top. Below is a demonstration of the same − Input Enter the number of rows : 8 Output The upper star triangle star pattern : * ... Read More

743 Views
In this article, we will understand how to print pyramid star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the number of rows : 8OutputThe desired output would be −The pyramid star pattern : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *AlgorithmStep 1 - ... Read More

846 Views
In this article, we will understand how to print the left triangle star pattern using Java. The pattern is formed by using multiple for-loops and print statements. Problem Statement Write a Java program to print the left triangle star pattern. Below is a demonstration of the same − Input Enter the number of rows : 8 Output The right triangle star pattern : * * * ... Read More

994 Views
In this article, we will understand how to print the left triangle star pattern in Java. This pattern is also known as the Mirrored Right Triangle Star pattern. Below is a demonstration of the same- Input: Number of rows: 6 Output: * * * * * * * * * * * * * * * * * * * * * Printing Left Triangle Star Pattern Following are the ... Read More

27K+ Views
Given a number, let's say N, write a Java program to check whether the given number is prime or not. Prime numbers are special numbers with only two factors 1 and that number itself, they cannot be divided by any other number. Example Scenario 1 Input: num = 1; Output: 1 is not a prime number Example Scenario 2 Input: num2 = 5; Output: 5 is a prime number 5 is divisible by 1 and 5 only Checking Prime Numbers using Factorization The naive approach to check a given number is prime or not is factorization. ... Read More

5K+ Views
An anagram is a word or phrase formed by rearranging the letters of two or more words. Suppose there are two strings. If both strings contain the same set of letters along with the same number of letters, regardless of their order, then we can say that both strings are anagrams; otherwise, not. Now, let's understand how we can find if two strings are anagrams or not in Java. How to Check if two Strings are Anagram? Follow the steps given below to solve the Anagram String problem: ... Read More

14K+ Views
In number theory, an Armstrong number is a pattern-based number whose sum of each digit raised to the power of total number of digits is equal to the given number itself. This article aims to explain Java programs that checks whether the given number is Armstrong or not. How to Check Armstrong Number? To check whether a number is an Armstrong or not, first, determine the total number of digits and assume it 'n'. Then separate each digit and raise them to the power of 'n'. In the last step, calculate the power of each digit and add all ... Read More

1K+ Views
In this article, we will understand how to check if an array contains a given value using two methods: Linear search and the HashSet class. For Linear Search, we will iterate through the array elements, comparing each element with the given input. For the HashSet class, we will utilize the contains() method to achieve this efficiently. Problem Statement Write a Java program to check if an array contains the given value − Input 1 Enter the number to be searched: 25 The elements in the integer array: 15 20 25 30 35 Output 1 The array contains the given value ... Read More