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
Advertisements
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?
