Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is the Java syntax to declare a string literal?
Think about how you write text in quotes.
How do you initialize a string using a constructor?
Don't forget to include `new`!
What keyword do you use to create a new string object in Java?
It’s also used commonly in other object creations.
True or False: Strings in Java can be modified after they are created.
Think about what happens when you try to change them.
Write a program that initializes a string using both a literal and a constructor, then prints both strings.
Remember, both declare the same text but how they do it differs!
Consider the following code: String str = new String("Test"); str = str + " String!"; What happens and why?
Think about how strings manage memory.
5 more questions in this section. Enroll free to practise them all.
Enroll free