Java Program #14 - Find duplicate characters in a String in Java

preview_player
Показать описание
Java Program to find duplicate characters in a String
In this video by Programming for Beginners we will learn to write Java Program to find duplicate characters in a String, using Java Tutorial videos.
This Java program is very important for your Java interview questions or if you are learning Java Programming language as a student.

Algorithm
1. Define a string.
2. Two loops will be used to find the duplicate characters. Outer loop will be used to select a character and initialize variable count by 1.
3. Inner loop will compare the selected character with rest of the characters present in the string.
4. If a match found, it increases the count by 1 and set the duplicates of selected character by '0' to mark them as visited.
5. After inner loop, if count of character is greater than 1, then it has duplicates in the string.

==========

Java Tutorial for Beginners Playlist:

All Java Programs Playlist:

We can learn Java Programming language to make web applications or mobile applications for android phones and several other applications for windows, Mac OS and Unix operating systems. Also we can make android applications using Java programming. The concepts covered will be related to basic java and core java that will help you in your next interview questions. You can use any version of Java but all concepts will be same for all java versions. I will be using Java SE 8.
Java is a high-level programming language. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.
Java is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Software Development Domain.

Java JDK:
Eclipse IDE:

YouTube Gears:

#JavaProgram #JavaTutorial #Programming #Java

============================
LIKE | SHARE | COMMENT | SUBSCRIBE

Thanks for watching :)
Рекомендации по теме
Комментарии
Автор

Hi if in my string p is printed two times, i want output as p=2 .. can u find a java program for this?

sanisan
Автор

why to convert String into CharArray, What's the purpose of it ?
i can write this code without converting into charArray ..

infact I have seen multiple videos in which they have convert String into CharArray,
but all the question I have implemented without converting into charArray ..

any example where you it is must to convert String into CharArray,

techkid