Java program to find the duplicate words in a string8 Jan 2025 | 2 min read In this program, we need to find out the duplicate words present in the string and display those words. Example: big black bug bit a big black dog on his big black nose To find the duplicate words from the string, we first split the string into words. We count the occurrence of each word in the string. If count is greater than 1, it implies that a word is duplicate in the string. ALGORITHM
Program:Output: Duplicate words in a given string : big black Next TopicJava Programs |
Java Program to find Largest Number in an Array We can find the largest number in an array in java by sorting the array and returning the largest number. Let's see the full example to find the largest number in java array. public class LargestInArrayExample{ public static int getLargest(int[]...
2 min read
Two Strings are called the anagram if they contain the same characters. However, the order or sequence of the characters can be different. In this program, our task is to check for two strings that, they are the anagram or not. For this purpose, we are...
3 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
It is a very interesting problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, Accenture, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section, we are going...
7 min read
In this program, we need to swap two strings without using a third variable. Str1: Good Str2: morning Swapping two strings usually take a temporary third variable. One of the approach to accomplish this is to concatenate given two strings into first string. Str1Str1 = Str1 + Str2=...
2 min read
Java Convert char to int We can convert char to int in java using various ways. If we direct assign char variable to int, it will return ASCII value of given character. If char variable contains int value, we can get the int value by calling Character.getNumericValue(char) method....
1 min read
In this program, we create a circular linked list, then traverse the list in the reverse order and print the nodes. Algorithm Define a Node class which represents a node in the list. It has two properties data and which will point to the node. Define...
7 min read
In this section, we will discuss what is the neon numbers and also create a Java program to check if the given number is neon or not. Also, we will find all the neon numbers between a specified range. Neon Number A positive integer whose sum of digits...
3 min read
In this section, we will learn what is a strontio number and also create Java programs to check if the given number is strontio. The strontio number program frequently asked in Java coding tests and academics. Strontio Number Strontio numbers are those four digits numbers when multiplied by...
3 min read
Java Convert int to double We can convert int to double in java using assignment operator. There is nothing to do extra because lower type can be converted to higher type implicitly. It is also known as implicit type casting or type promotion. Java int to double Example Let's...
1 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