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...

Given two strings like x=?hello? and y=?open?, remove any
character from string x which is also used in string y,
thus making the result x=?hll?.

Answer Posted / guest

public static void main(String[] args) {
String str_x = "hello";
String str_y = "open";

StringBuffer result = new StringBuffer();

for (int i=0; i<str_x.length();i++){
if (str_y.indexOf(str_x.charAt(i)) < 0)
result.append(str_x.charAt(i));
}

System.out.print(result);
}

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a class and object?

1048


What is encapsulation in oops?

1006


What is coupling in oop?

1020


Explain the concepts involved in Object Oriented programming.

1220


What is cohesion in oop?

1052


What is encapsulation process?

1038


How oops is better than procedural?

1089


What is debug class?what is trace class? What differences are between them? With examples.

2188


i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<

1848


What is encapsulation with example?

1096


What is object in oops?

1056


What are main features of oop?

1119


What are the benefits of oop?

1246


How do you define a class in oop?

1116


What is meant by multiple inheritance?

1241