Challenge - 5 Problems
String Immutability Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 code output
intermediate2:00remaining
What is the output of this Java code involving String immutability?
Consider the following Java code snippet. What will be printed when it runs?
Java
public class Test { public static void main(String[] args) { String s = "hello"; s.toUpperCase(); System.out.println(s); } }
Attempts:
2 left
💻 code output
intermediate2:00remaining
What does this code print after String concatenation?
Look at this Java code. What will be printed?
Java
public class Test { public static void main(String[] args) { String s = "cat"; s += "dog"; System.out.println(s); } }
Attempts:
2 left
🔧 debug
advanced2:00remaining
Which option causes a compilation error due to String immutability?
Which of the following Java code snippets will cause a compilation error?
Attempts:
2 left
🧠 conceptual
advanced2:00remaining
How does Java handle String immutability internally?
Which statement best describes how Java implements String immutability?
Attempts:
2 left
💻 code output
expert2:00remaining
What is the output of this Java code involving String references?
Analyze the code below. What will be printed?
Java
public class Test { public static void main(String[] args) { String a = "abc"; String b = a; a = a + "d"; System.out.println(b); } }
Attempts:
2 left
