English

Predict the output of the following: String S1 = "Computer World"; String S2 = "COMPUTER WORLD"; String S3 = "Computer world"; String S4 = "computer world"; System.out.println(S1 + "equals"+ S2 + - Computer Applications

Advertisements
Advertisements

Question

Predict the output of the following:

String S1 = "Computer World"; 
String S2 = "COMPUTER WORLD"; 
String S3 = "Computer world"; 
String S4 = "computer world"; 
System.out.println(S1 + "equals"+ S2 + " " + S1.equals(S2)); 
System.out.println(S1 + "equals"+ S3 + " " + S1.equals(S3)); 
System.out.println(S1 + "equals"+ S4 + " " + S1.equals(S4)); 
System.out.println(S1 + "equalslgnoreCase"+ S4 + " " + S1.equalslgnoreCase(S4)); 
Answer in Brief

Solution

Computer WorldequalsCOMPUTER WORLD false

Computer WorldequalsComputer world false

Computer Worldequalscomputer world false

Computer WorldequalsIgnoreCasecomputer world true

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

APPEARS IN

Avichal Computer Applications [English] Class 10 ICSE
Chapter 4 String Handling
EXERCISES | Q IV. 7. | Page 288
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×