Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started