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 a class and object?
What is encapsulation in oops?
What is coupling in oop?
Explain the concepts involved in Object Oriented programming.
What is cohesion in oop?
What is encapsulation process?
How oops is better than procedural?
What is debug class?what is trace class? What differences are between them? With examples.
i=20;k=0;
for(j=1;k-i;k+=j<10?4:3)
{
cout< What is encapsulation with example? What is object in oops? What are main features of oop? What are the benefits of oop? How do you define a class in oop? What is meant by multiple inheritance?