Java String FAQs or Interview Questions
A list of top Java String FAQs (Frequently Asked Questions) or interview questions are given below. These questions can be asked by the interviewer.
1) How many objects will be created in the following code?
String s1="javatpoint"; String s2="javatpoint";
Answer: Only one.
2) What is the difference between equals() method and == operator?
The equals() method matches content of the strings whereas == operator matches object or reference of the strings.
3) Is String class final?
Answer: Yes.
4) How to reverse String in java?
Input:
this is javatpoint
Output:
tnioptavaj si siht
5) How to check Palindrome String in java?
Input:
nitin
Output:
true
Input:
jatin
Output:
false
6) Write a java program to capitalize each word in string?
Input:
this is javatpoint
Output:
This Is Javatpoint
7) Write a java program to reverse each word in string?
Input:
this is javatpoint
Output:
siht si tnioptavaj
8) Write a java program to tOGGLE each word in string?
Input:
this is javatpoint
Output:
tHIS iS jAVATPOINT
9) Write a java program reverse tOGGLE each word in string?
Input:
this is javatpoint
Output:
sIHT sI tNIOPTAVAJ
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteYour blog has one of the best explanation on java programs with appropriate links. Thanks for sharing.
ReplyDeleteCheers,
https://www.flowerbrackets.com/java-program-check-whether-string-palindrome/
Nice explanation on java string faqs with examples. Thanks for sharing.
ReplyDeleteCheers,
https://www.flowerbrackets.com/java-remove-character-from-string/
Your blog has content with all useful links that are useful in interview. Thanks
ReplyDeleteCheers,
https://www.flowerbrackets.com/reverse-string-in-java/
Best faq on java with appropriate links. Thanks for sharing.
ReplyDeleteCheers,
https://www.flowerbrackets.com/java-convert-string-to-date/
Well explained string operation .
ReplyDeletethere are good String program collection visit Top String program
Best java string faqs. Thanks for sharing.
ReplyDeletehttps://www.flowerbrackets.com/reverse-string-in-java/