0 votes
in JAVA by
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);

}

}

1 Answer

0 votes
by
it will print “PANKAJ” because we are assigning s2 String to s1. Don’t get confused with == comparison operator.

Related questions

0 votes
asked Mar 16, 2021 in JAVA by Robindeniel
0 votes
asked Apr 10, 2021 in JAVA by Robindeniel
...