Qtr No. 213, New Town Yehlanka Indore 454775
What will be the output of the code given below?
public class Tester {
public static void main(String args[]) {
String input1 = "warner";
String input2 = new String("WARNER");
input2.toLowerCase();
if (input1 == input2) {
System.out.println(" Welcome " + input1);
} else if (input1.equals(input2)) {
System.out.println(" Welcome " + input2);
} else {
System.out.println("Welcome");
}
}
}
Welcome
Welcome warner
Welcome WARNER
Compilation error - datatype mismatch, cannot compare String literal with String object
To get all Self Assessment - Programming using Java Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee
We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.
Qtr No. 213, New Town Yehlanka Indore 454775
admin@prepflix.in
Updated on Mon, 8 Dec 2025