26 - Java Program to find the duplicate characters in a string.

26 - Java Program to find the duplicate characters in a string.

Software Testing And Automation

3 года назад

23,864 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Clare Ogochukwu
Clare Ogochukwu - 26.10.2023 05:48

Please I have a project based on voting online management system, please how can I do it 🙏

Ответить
harshitha c
harshitha c - 14.10.2023 11:55

String a="abcdef";
String b="dghijk";
String c= "lmnopa"; can any one help me from these 3 strings to be compared and find duplicates in java8

Ответить
Karan Sharma
Karan Sharma - 03.04.2023 16:55

Good explanation, just needed more clarity on the reason why we are assigning value of string[j] = 0, as i believe while traversing string from left to right, we already have compared that value to that of i, so what is the use ?

Ответить
shrinivas rs
shrinivas rs - 15.03.2022 18:03

The program is wrong for some string valure like
Imagine
String str= ssss;
Your repeated value will print like this
4
3
2
Try it

Ответить
sai nihash
sai nihash - 06.01.2022 18:50

is this code correct way of writing sir
public class Rough {

public static void main(String[] args) {

String str = "hi this is java language";
for (int i = 0; i < str.length() - 1; i++) {
int count = 0;
for (int j = i + 1; j < str.length(); j++) {
if (str.charAt(i) == str.charAt(j)&& str.charAt(i)!=' ') {
count++;
}
}
if (count == 1) {
System.out.print(str.charAt(i)+" ");
}
}

}
}

Ответить
Rohit Miryala
Rohit Miryala - 05.12.2021 09:44

what if more than twice the characters are repeated ??

Ответить
yusuf harun
yusuf harun - 16.10.2021 18:46

Thanks for the video! from Ottawa.

Ответить
Mokoko
Mokoko - 15.10.2021 21:47

second one not string it's a char array sir

Ответить
Ranga Dilshan
Ranga Dilshan - 13.03.2021 17:59

Thank You

Ответить