Computer Science, asked by APOLLOthunderstrike, 4 months ago

intelligent people only . I will mark you brainliest

What is the output? [3]

String s=”Strength”,t=”will”;

System.out.println(s.startsWith(“tr”));

System.out.println(t.indexOf(„l‟));

System.out.println(s.substring(4).concat(t.substring(1,3)));​

Answers

Answered by Oreki
0

\textsf{\large \textbf{Given Snippet}}

   \texttt{String s = "Strength", t = "will";}\\\texttt{System.out.println(s.startsWith("tr"));}\\\texttt{System.out.println(t.indexOf("l"));}\\\texttt{System.out.println(s.substring(4).concat(t.substring(1,3)));}

\textsf{\large \textbf{After Execution}}

   \texttt{s.startsWith("tr") ->} \text{ \textbf{false}}\\\texttt{t.indexOf("l") ->} \text{ \textbf{2}, As `l' first occurs at index 2.}\\\\\texttt{s.substring(4).concat(t.substring(1,3))}\\\texttt{"ngth".concat("il")}\\\texttt{-> "ngthil"}

   \textsf{\textit{Out\symbol{112}ut: }} \texttt{false}\\\texttt{\hspace{3em} 2}\\\texttt{\hspace{3em} ngthil}

Similar questions