In your day-to-day programming activities, you must be coming across multiple situation where you need to check if a string is empty. There are various ways to do this and some use string1.equals(“”). NEVER do this. Best way to check if string is empty or not is to use length() method. This method simply return […]
This is very common interview question where you have to find duplicate words in a string or text file. This can be solved using some overly-complex algorithms also, but in this post, I will propose rather an easy way using Java Collections API. 1. Problem Lets say we have an String/ text like below- “a […]
All of us must have gone though interview questions related to String class in java. These String interview questions range from immutability to memory leak issues.