Suppose that we have executed the following statements in a program. String titl
ID: 3884076 • Letter: S
Question
Suppose that we have executed the following statements in a program. String title = new String("Drown by Junot Diaz"): String quietTitle = new String("Drown by Junot Diaz"): String loudTitle = new String("DROWN BY JUNOT DIAZ''): String emoTitle = newString("DROWN!!! By Junot Diaz"): String oddTitle = new String("Drown BY Junot Diaz"): Give the value (either true or false) for the statements in b) to f) a. title.equals(quietTitle) b. title.equalsIgnoreCase(quietTitle) c. title = = quietTitle d. emoTitle.equalsIgnoreCase(oddTitle) e. loudTitleequals(oddTitle)Explanation / Answer
a) true --> both title and quitetitle has same string
b) true --> as from a), both are same string even with case, this is definitely true
c) false --> since we have created a separate string object though string values are same and both variables point to different objects in memory
d) false --> since string values are not same, so case matching is redundat, it fails at first place itself
e) false --> since string values are not same
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.