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.

21st Nov 2017, 2:27 PM
Abdalluh
9 Answers
0
can any one write the code
22nd Nov 2017, 1:29 PM
Abdalluh
0
no
22nd Nov 2017, 1:58 PM
Abdalluh
0
i want to write a code if all characters in s1 appear in s2
22nd Nov 2017, 2:16 PM
Abdalluh
0
yes
22nd Nov 2017, 2:28 PM
Abdalluh
- 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.
22nd Nov 2017, 12:56 PM
Aaron Becker
Aaron Becker - avatar
- 1
@Abdullah is what I wrote, correct?
22nd Nov 2017, 1:34 PM
Aaron Becker
Aaron Becker - avatar
- 1
@Abdulla How was it wrong? I cannot help without understanding the problem.
22nd Nov 2017, 2:00 PM
Aaron Becker
Aaron Becker - avatar
- 1
@Abdullah Is "sip" in "ship"?
22nd Nov 2017, 2:19 PM
Aaron Becker
Aaron Becker - avatar
- 1
Is "stop" in "pots"?
22nd Nov 2017, 2:20 PM
Aaron Becker
Aaron Becker - avatar