Java Concepts Assessment

Java Concepts Assessment

Assessment

Flashcard

Information Technology (IT)

University

Hard

Created by

Quizizz 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

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?