Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

describe the stages involved in human resource planning

Answered: 1 week ago