English

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)); - Computer Applications

Advertisements
Advertisements

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));
Short Answer

Solution

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

shaalaa.com
  Is there an error in this question or solution?
Chapter 4: String Handling - Review Insight [Page 284]

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 4 String Handling
Review Insight | Q 2. | Page 284
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×