Java Concepts Assessment

Java Concepts Assessment

Assessment

Flashcard

Information Technology (IT)

University

Practice Problem

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

20 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What is an immutable class in Java?

Back

An immutable class in Java is a class whose instances cannot be changed after creation.

2.

FLASHCARD QUESTION

Front

How do you create an immutable class in Java?

Back

Declare the class as final, make fields private and final, provide a constructor, and omit setter methods.

3.

FLASHCARD QUESTION

Front

Which of the following classes is immutable: String, StringBuilder, StringBuffer?

Back

String

4.

FLASHCARD QUESTION

Front

What method would you use to find the length of a String in Java?

Back

Use the length() method of the String class.

5.

FLASHCARD QUESTION

Front

How do you concatenate two Strings in Java?

Back

Use '+' operator or String.concat() method.

6.

FLASHCARD QUESTION

Front

What is the primary difference between StringBuilder and StringBuffer?

Back

StringBuilder is faster and not thread-safe; StringBuffer is thread-safe but slower.

7.

FLASHCARD QUESTION

Front

Which class is synchronized: StringBuilder or StringBuffer?

Back

StringBuffer

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?