...

/

Quiz on Strings and Arrays

Quiz on Strings and Arrays

Test your knowledge of strings and arrays in Java.

We'll cover the following...
1

(Select all that apply.) We want to store the following string in the variable msg. Which of the following shows the correct syntax in Java?

This string has text1 and text2 in it
A)

String msg = "This string has text1 and text2 in it";

B)

String msg = 'This string has text1 and text2 in it';

C)

String msg = "This string has text1 " and " text2 in it";

D)

String str1 = "This string has text1";

String str2 = " and text2 in it";

String msg = str1 + str2;

Question 1 of 60 attempted
Access this course and 1400+ top-rated courses and projects.