Java program to print the following pattern8 Jan 2025 | 1 min read *000*000* Algorithm:
Program:Output: *000*000* 0*00*00*0 00*0*0*00 000***000 Next TopicJava Programs |
Write a code to check whether one string is a rotation of another? File: RotationString .java public class RotationString { public static boolean checkRotation(String st1, String st2) { if (st1.length() != st2.length()) { return false; } String st3 = st1 + st1; if (st3.contains(st2)) return true; else return false; } public static void main(String[] args) { String str1...
1 min read
In this program, we need to find the frequency of each character present in the word. Picture perfect To accomplish this task, we will maintain an array called freq with same size of the length of the string. Freq will be used to maintain the count of...
3 min read
Java program to print the following pattern on the console Algorithm: STEP 1: START STEP 2: SET coe=1, rows= 6. STEP 3: SET i=0. REPEAT STEP 4 to STEP 11 UNTIL i STEP 4: SET space = 1. REPEAT STEP 5 and STEP 6 UNTIL space<(rows ?i) STEP 5: PRINT...
2 min read
Write a code to prove that strings are immutable in java? Following program demonstrate it. File: ProveStringImmutable .java public class ProveStringImmutable { public static void referenceCheck(Object x, Object y) { if (x == y) { System.out.println("Both pointing to the same reference"); } else { System.out.println("Both are pointing to different reference"); } } public static void...
1 min read
In this section, we will learn what is an emirp number and also create Java programs to check if the given number is emirp or not. The emirp number Java program frequently asked in Java coding tests to check the logic of the programmer. Emirp Number A number...
2 min read
Java Program to find the frequency of odd & even numbers in the given matrix In this program, we need to find the frequencies of odd and even numbers present in the matrix. In the above example, all odd numbers are represented by the blue square and...
3 min read
In this program, we will create a doubly linked list then, iterate through the list to find out the minimum and maximum node. We will maintain two variables min and max. Min will hold the minimum value node, and max will hold the maximum value node....
6 min read
Java Convert Binary to Decimal We can convert binary to decimal in java using Integer.parseInt() method or custom logic. Java Binary to Decimal conversion: Integer.parseInt() The Integer.parseInt() method converts string to int with given redix. The signature of parseInt() method is given below: public static int parseInt(String s,int redix) Let's see...
2 min read
? In Java, the sort() method is a static and overloaded method defined in the java.util.Arrays class. It is used to sort arrays values of different types. The order may be in ascending or descending order. The numerical and lexicographical (alphabetical) order is widely used. The sort()...
11 min read
In this program, we will create a singly linked list and add a new node at the end of the list. To accomplish this task, add a new node after the tail of the list such that tail's will point to the newly added...
4 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India