Java J2EE Question and Answers
9. | Can we use String in switch case? |
---|---|
Java 7 extended the capability of switch case to use Strings also, earlier versions doesn't support this. | |
10. | Write a function to find out longest palindrome in a given string? |
---|---|
A String can contains palindrome strings in it and to find longest palindrome in given String is a programming question. | |
11. | How to convert String to byte array and vice versa? |
---|---|
We can use String getBytes() method to convert String to byte array and we can use String constructor new String(byte[] arr) to convert byte array to String. | |
12. | Why String is popular HashMap key in Java? |
---|---|
|
|