Home / Questions / State the data type and values of a and b after the following segment is executed: String s1 = "Computer", s2 = "Applications" a = (s1.compareTo(s2)); b = (s1.equals(s2));
Explanatory Question

State the data type and values of a and b after the following segment is executed:

String s1 = "Computer", s2 = "Applications"
a = (s1.compareTo(s2));
b = (s1.equals(s2));

👁 89 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

Data type of a is int and value is 2. Data type of b is boolean and value is false.