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
Is abstract thinking intelligence?
What is meant by multiple inheritance?
How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction
Can static class have constructor?
What is abstraction with example?
Explain the advantages of inheritance.
write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.
to find out the minimum of two integer number of two different classes using friend function
How do you explain polymorphism?
What are properties in oop?
How do you define social class?
what type of question are asked in thoughtworks pair programming round ?
What is oops with example?
When not to use object oriented programming?
What is constructor in oop?