Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

aabccdee
Find the used alphabets as abcde ?

Answer Posted / hitesh

public static void main(String[] args) {

String s1 = "aaabbccccaaa";
String s2 = " ";
for (int i = 0; i < s1.length(); i++) {
if (i == 0) {
s2 = s2.concat("" + (s1.charAt(i)));
}

if (s2.contains(s1.charAt(i) + "")) {
continue;
} else {
s2 = s2.concat("" + (s1.charAt(i)));
}
}
System.out.println(s2);
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is linkedlist in java?

935


What is the final variable?

1171


Explain the difference between protected and default access.

948


Is null function in java?

979


What is super constructor?

948


Why singleton is not thread safe?

945


Write a program to solve producer consumer problem in java?

952


Why are global variables used?

949


What is an empty string in css?

981


What is boolean logic?

971


Can we override private constructor in java?

913


What is the use of object and class classes?

996


Explain about the interpreter in java?

996


Which browsers work with java?

1024


what is instanceof operator used in java?

975