Search Interview Questions
| More than 3000 questions in repository.|
There are more than 900 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Java - Interview Questions and Answers|
|Very frequently asked. Usually asked in different variants like Diff between StringBuffer , String Builder ; Difference between StringBuilder and String class; Choice between these classes etc.|
|Ans. A string buffer implements a mutable sequence of characters. A string buffer is like a String, but can be modified. At any point in time it contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls. |
The String class represents character strings. All string literals in Java programs, such as "abc" are constant and implemented as instances of this class; their values cannot be changed after they are created.
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  java   string   stringbuffer   frequently asked Asked in 18 Companies basic   frequent|
Try 1 Question(s) Test
|Difference between == and .equals() ?|
|Why is String immutable in Java ?|
| Explain the scenerios to choose between String , StringBuilder and StringBuffer ?|
What is the difference between String , StringBuilder and StringBuffer ?
|What are different ways to create String Object? Explain.|
|Why Char array is preferred over String for storing password?|
|What is a String Pool ?|
|How does making string as immutable helps with securing information ? How does String Pool pose a security threat ?|
|How is string object immutable if we can concat a string to it ?|
|What is StringJoiner ?|
| Which of the following is false about main method ?|
a. It should be declared public and static
b. it should have only 1 argument of type String array
c. We can override main method
d. We can overload main method