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
What is encapsulation in simple terms?
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
What is new keyword in oops?
What is balance factor?
Get me a number puzzle game-program
What is encapsulation example?
What are the components of marker interface?
Can we define a class within the interface?
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?
What are the 3 pillars of oop?
What is oops and why we use oops?
what are the ways in which a constructors can be called?
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(); }
write knight tour problem which is present in datastructure
What is abstraction and encapsulation?