What gets printed to the screen by the following segment of code? String str1 = "hello"; String str2 = "world"; if (!str1.equals(str2)) { System.out.println(str1+" "+str2); } else { System.out.println(str2+" "+str1); hello world world hello Nothing gets printed by this segment
What gets printed to the screen by the following segment of code? String str1 = "hello"; String str2 = "world"; if (!str1.equals(str2)) { System.out.println(str1+" "+str2); } else { System.out.println(str2+" "+str1); hello world world hello Nothing gets printed by this segment
Chapter16: Graphics
Section: Chapter Questions
Problem 2RQ
Related questions
Question
![What gets printed to the screen by the following
segment of code?
String str1 = "hello";
String str2 = "world";
if (!str1.equals (str2)) {
System.out.println(str1+" "+str2);
}
else {
System.out.println(str2+" "+str1);
%3D
hello world
world hello
Nothing gets printed by this segment](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fdf21274b-559f-4cd8-8d49-6d47b553b19f%2Ffd02ead8-d716-451f-a439-2a9953a9814e%2F22ifuz_processed.jpeg&w=3840&q=75)
Transcribed Image Text:What gets printed to the screen by the following
segment of code?
String str1 = "hello";
String str2 = "world";
if (!str1.equals (str2)) {
System.out.println(str1+" "+str2);
}
else {
System.out.println(str2+" "+str1);
%3D
hello world
world hello
Nothing gets printed by this segment
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT