0
Can any on hilp me to answer this qouestion
Write a java program to test if the String S1 overlaps the String S2 or not. use a code that will set the boolean variable overlap to true if s1 overlaps s2 and false otherwise. String s1 is said to overlap String s2 if all of the characters in s1 also appear in s2. Read both of s1 and s2 as an input from the keyboard.
9 Answers
0
can any one write the code
0
no
0
i want to write a code if all characters in s1 appear in s2
0
yes
- 1
I believe that your question needs some clarification. Let's suppose that the user enters "sip" for s1 and "ship" for s2. By your definition of overlap, s1 overlaps s2 because all of the characters in s1 also appear in s2. If this is true then overlap has less constraints than substring. Substrings are when you find s1 in s2.
- 1
@Abdullah is what I wrote, correct?
- 1
@Abdulla How was it wrong? I cannot help without understanding the problem.
- 1
@Abdullah Is "sip" in "ship"?
- 1
Is "stop" in "pots"?