Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
What is the output of below program?
Home
JAVA
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.
Related questions
0
votes
Q: What is the output of below code snippet?
asked
Mar 16, 2021
in
JAVA
by
Robindeniel
java-string
java-output
Java-questions-answers
0
votes
Q: Write a program to print all permutations of String?
asked
Mar 16, 2021
in
JAVA
by
Robindeniel
string
permutations-string
string-permutations
java-string
Java-questions-answers
0
votes
Q: What is String Pool?
asked
Mar 16, 2021
in
JAVA
by
Robindeniel
#string-pool
pool-string
java-string
string-pool-java
Java-questions-answers
0
votes
Q: How to convert String to byte array and vice versa?
asked
Mar 16, 2021
in
JAVA
by
Robindeniel
#convert-string
byte-array-to-string
string-to-byte-array
bytearray
java-string
Java-questions-answers
0
votes
Q: What is String subSequence method?
asked
Mar 16, 2021
in
JAVA
by
Robindeniel
#subsequence-methods
method-subsequence
string-subsequence
subsequence-string
java-string
Java-questions-answers
0
votes
Q: Write a method that will remove given character from the String?
asked
Mar 16, 2021
in
JAVA
by
Robindeniel
#string-character
java-string
java
Java-questions-answers
0
votes
Q: What are different ways to create String Object?
asked
Mar 16, 2021
in
JAVA
by
Robindeniel
#string-object
java-string-object
java-string
java
Java-questions-answers
0
votes
Q: What is String in Java? String is a data type?
asked
Mar 16, 2021
in
JAVA
by
Robindeniel
#string-java
java-string
java
string
Java-questions-answers
0
votes
Q: What is the output of below program?
asked
Mar 16, 2021
in
JAVA
by
Robindeniel
#java-output
java-program
Java-questions-answers
0
votes
Q: Given, the below condition ,identify the output
asked
Apr 10, 2021
in
JAVA
by
Robindeniel
java
java-questions-and-answers
java-mcq
core-java-mcq
java-multiple-choice-questions
java-questions-2021
java-interview-questions
java-advanced-questions
Java-questions-answers
...