Copyright

String Declaration in Java

Instructions:

Choose an answer and hit 'next'. You will receive your score and answers at the end.

question 1 of 3

Which of the following correctly declares a new String object called hello?

Create Your Account To Take This Quiz

As a member, you'll also get unlimited access to over 75,000 lessons in math, English, science, history, and more. Plus, get practice tests, quizzes, and personalized coaching to help you succeed.

Try it risk-free
Try it risk-free for 30 days. Cancel anytime.
Already registered? Log in here for access

1. What type of string is 'Welcome!' in the code below?

2. Examine the following code. What will the result of be?

Create your account to access this entire worksheet
A Premium account gives you access to all lesson, practice exams, quizzes & worksheets
Access to all video lessons
Quizzes, practice exams & worksheets
Certificate of Completion
Access to instructors
Create an account to get started Create Account

About This Quiz and Worksheet

Declaring strings in Java is the subject of this combination of a quiz and worksheet. Questions focus on the correct declaration of a given object, and what would happen if a certain type of string exists in a string constant pool.

Quiz and Worksheet Goals

To understand how well you know the concept, review with questions that include these topics:

  • A type of string in a given code segment
  • The result of a given code
  • Declaring a string with an example value
  • What happens if a type of string exists in the string constant pool

Skills Practiced

  • Knowledge application - use what you know to answer questions about the result of existing code
  • Defining key concepts - ensure that you know the name of a specific type of string when it appears in a piece of code
  • Information recall - remember what you have learned about declaring a new string object

Additional Learning

To discover more, head over to the lesson titled String Declaration in Java. With this lesson, you can explore the additional material listed here:

  • Creating instances of a string class
  • Using code to determine equality
  • Examples of code output
Support