In Java, a String is an object that represents a sequence of characters. Java provides the String class in the java.lang package with powerful methods for text processing, making it a fundamental part of programming with Java.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Which class is used to create string objects in Java?
Correct
Incorrect
Question 2 of 15
2. Question
What is the default value of a String variable in Java?
Correct
Incorrect
Question 3 of 15
3. Question
Which of these methods returns the length of a string?
Correct
Incorrect
Question 4 of 15
4. Question
What will str1 == str2 return if both are created using new String(“Java”)?
Correct
Incorrect
Question 5 of 15
5. Question
What does equals() method compare in strings?
Correct
Incorrect
Question 6 of 15
6. Question
Which method is used to concatenate two strings?
Correct
Incorrect
Question 7 of 15
7. Question
Are strings in Java mutable or immutable?
Correct
Incorrect
Question 8 of 15
8. Question
What does the substring(int beginIndex, int endIndex) method return?
Correct
Incorrect
Question 9 of 15
9. Question
What is the output of “Hello”.charAt(1)?
Correct
Incorrect
Question 10 of 15
10. Question
What does trim() method do?
Correct
Incorrect
Question 11 of 15
11. Question
What is the result of “abc”.compareTo(“abd”)?
Correct
Incorrect
Question 12 of 15
12. Question
Which string method checks whether a string contains a specific sequence?
Correct
Incorrect
Question 13 of 15
13. Question
What will be the result of “Java”.toUpperCase()?
Correct
Incorrect
Question 14 of 15
14. Question
Can we use + operator to concatenate strings?
Correct
Incorrect
Question 15 of 15
15. Question
Which class should be used for mutable strings in Java?
Correct
Incorrect
Summary
Java Strings are immutable objects that store sequences of characters. With methods like length(), equals(), substring(), and concat(), the String class supports efficient text manipulation and plays a crucial role in Java applications.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.