You have given a String and a subString or a character and you need to find out whether given String contains the given character or substring, how would you do that? Well, there are three main ways to search String in Java, the …
Read more
How I make immutable objects in Java? I've always thought that all objects are immutable, because if you change the content of an String example, it will always create you an new String object and point to that. Howeve…
Read more
There are multiple ways to split a String in Java, but two of the most common ways are by using StringTokenizer and the split method of String class. You can use either one of them, but when to use which one? This short article…
Read more
here are many ways to compare String in Java e.g. you can use equals() and equalsIgnoreCase() for equality check and compare() and compareTo() for ordering comparison. You can even use the equality operator == to perform ref…
Read more
Just like there are many ways for writing String to text file, there are multiple ways to read String form File in Java. You can use FileReader, BufferedReader, Scanner, and FileInputStream to read text from file. One thin…
Read more
Integer to String conversion in Java There are many ways to convert an Integer to String in Java e.g. by using Integer.toString(int) or by using String.valueOf(int) , or by using new Integer(int).toString() , or by using …
Read more
Hello Java Programmers, if you are wondering how to convert a String to char value in Java then you have come to the right place. Earlier, we have seen how to convert a character to String in Java and today we'll learn oppos…
Read more
Difference between String, StringBuffer, and StringBuilder is probably one of the oldest yet most popular interview question in the history of Java developer interviews. I have personally asked this question almost 4 to 5 times. …
Read more