Strings

Top 7 Java String simple but tricky Interview Questions

By ajagekar.s.d. April 25, 2023

Q.1

Use of String.intern()?

Will it release memory from heap?

Q.2

Public static void main(String args...){}

Will it work as main method?

Q.3

Why is string immutable in Java

Why not other classes?

Q.4

String a="yes" String b="yes" a==b or a.equals(b)

What is the result of above conditions?

Q.5

Why is password stored using char[] and not in String?

Can you think over it?

Q.6

String a = new String("Hello");

How many objects are getting created here?

Q.7

StringJoiner class

Do you know about above class?

Thank you

Please comment and visit website for answer's