Question: CENG523-CLASS WORK FOR STRINGS (15 MARKS) 1. Suppose that sl, S2, S3, and s4 are four strings, given as follows: (10MARKS) String s1 - Welcome

 CENG523-CLASS WORK FOR STRINGS (15 MARKS) 1. Suppose that sl, S2,

CENG523-CLASS WORK FOR STRINGS (15 MARKS) 1. Suppose that sl, S2, S3, and s4 are four strings, given as follows: (10MARKS) String s1 - "Welcome to Java"; String s2 s1: String s3 new String("Welcome to Java"); String s4 - "Welcome to Java"; What are the results of the following expressions? a. si S2 b.si es 4 d. sl.equals(83) e. sl.equals(4) 1. Welcome to Java".replace("Java", "HTML") g. sl.replace('d', T) h. sh.replaceAll("o", "T") i. si.replaceFirst("o", "T") j. sl.toCharArray 2. Let si be "Welcome" and s2 be welcome". (2MARKS) Write the code for the following statement Replace all occurrences of the character e with Eins and assign the new string to s2. 3. What is wrong in the following program? (3MARKS) public class Test String text; public void Test(Strings) text- 1 public static void main(String[] args) { Test test-new Test("ABC"); System.out.println(test)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!