Login
Remember
Register
Ask a Question
What is the output of below program?
0
votes
asked
Mar 16, 2021
in
JAVA
by
Robindeniel
What is the output of below program?
package com.journaldev.strings;
public class StringTest {
public static void main(String[] args) {
String s1 = new String("pankaj");
String s2 = new String("PANKAJ");
System.out.println(s1 = s2);
}
}
string-output
java-string
Java-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Mar 16, 2021
by
Robindeniel
it will print “PANKAJ” because we are assigning s2 String to s1. Don’t get confused with == comparison operator.
...