118k views
2 votes
For each of the following, write a single statement that performs the indicatedtask:

1. Compare the string in s1 to the string in s2 for equality of contents.
2. Append the string s2 to the string s1, using +=.
3. Determine the length of the string in s1.

User Elbillaf
by
6.0k points

1 Answer

1 vote

Answer:

Kindly check explanation

Step-by-step explanation:

public class ComparisonwithEquals {

public static void main(String[] args) {

String s1 = "testing";

String s2 = "codeblocks";

System.out.println(s1.equals(s2));

.

2.)

s1 = 'Kolade'

s2 = 'Taofeek'

s1 += s2

3.)

To determine the length of a string, we use the len method

Length_s1 = len(s1

User Andy Dennie
by
5.7k points