Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PART A What is the result of the following code segment? String word = starfish; String x = word.substring(4); String y = word.substring(3, 8); if(

PART A

What is the result of the following code segment? String word = "starfish"; String x = word.substring(4); String y = word.substring(3, 8); if( x == y) System.out.print(1); else if( x.equals(y)) System.out.print(2); else System.out.print(3);

A) 1

B) 2

C) 3

D) 12

E) 13

PART B

Assume the String objects word1 and word2 are initialized as shown below. What is the value of the expression word1.equals(word2)?

String word1 = "march"; String word2 = "MARCH";

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

Students also viewed these Databases questions