Computer Science, asked by dogratwinkle924, 4 months ago

9. Predict the output.
int res = integer.valueof("100").compareTo(new Integer(100));
System.out.println(res);​

Answers

Answered by Oreki
6

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

   \texttt{int res = Integer.valueOf("100").compareTo(new Integer(100));}\\\texttt{System.out.println(res);}

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

   \texttt{0}

\textsf{\large \textbf{Explanation}}

  \texttt{int res = Integer.valueOf("100").compareTo(new Integer(100));}\\\texttt{\:\:-> res = "100".compareTo(100);}\\\texttt{\:\:-> res = 0; (As no difference found)}

Similar questions