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 encapsulation in simple terms?

974


write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory

3172


What is new keyword in oops?

992


What is balance factor?

1017


Get me a number puzzle game-program

2180


What is encapsulation example?

981


What are the components of marker interface?

996


Can we define a class within the interface?

986


INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?

2146


What are the 3 pillars of oop?

1099


What is oops and why we use oops?

988


what are the ways in which a constructors can be called?

2042


What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }

2494


write knight tour problem which is present in datastructure

2596


What is abstraction and encapsulation?

941