What is printed by the code below? a) String[] arr = new String [2] ; arr[0] = "Hello"; arr [1] = "Hi"; String [] arr2 = arr; arr [0] = "How"; System.out.println(arr2 [0]); String test1 = "Hello"; String test2 = new String ("Hello"); String test3 = "Hello"; System.out.println System.out.println (test1 == test2); (test3 == test2); System.out.println (test1 == test3);

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question
What is printed by the code below?
a) String[] arr = new String [2] ;
arr[0] = "Hello";
arr [1] = "Hi";
String [] arr2 = arr;
arr [0] = "How";
System.out.println(arr2 [0]);
String test1 = "Hello";
String test2 = new String ("Hello");
String test3 = "Hello";
System.out.println
System.out.println
(test1 == test2);
(test3 == test2);
System.out.println (test1 == test3);
Transcribed Image Text:What is printed by the code below? a) String[] arr = new String [2] ; arr[0] = "Hello"; arr [1] = "Hi"; String [] arr2 = arr; arr [0] = "How"; System.out.println(arr2 [0]); String test1 = "Hello"; String test2 = new String ("Hello"); String test3 = "Hello"; System.out.println System.out.println (test1 == test2); (test3 == test2); System.out.println (test1 == test3);
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT